@nxtedition/rocksdb 11.1.3 → 11.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/binding.cc
CHANGED
|
@@ -1487,13 +1487,18 @@ NAPI_METHOD(regex_init) {
|
|
|
1487
1487
|
std::string pattern;
|
|
1488
1488
|
NAPI_STATUS_THROWS(GetString(env, argv[0], pattern));
|
|
1489
1489
|
|
|
1490
|
-
|
|
1490
|
+
try {
|
|
1491
|
+
auto regex = std::make_unique<std::regex>(pattern, std::regex::optimize | std::regex::ECMAScript);
|
|
1491
1492
|
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1493
|
+
napi_value result;
|
|
1494
|
+
NAPI_STATUS_THROWS(napi_create_external(env, regex.get(), Finalize<std::regex>, regex.get(), &result));
|
|
1495
|
+
regex.release();
|
|
1495
1496
|
|
|
1496
|
-
|
|
1497
|
+
return result;
|
|
1498
|
+
} catch (const std::exception& e) {
|
|
1499
|
+
napi_throw_error(env, nullptr, e.what());
|
|
1500
|
+
return 0;
|
|
1501
|
+
}
|
|
1497
1502
|
}
|
|
1498
1503
|
|
|
1499
1504
|
NAPI_METHOD(regex_test) {
|
|
@@ -1513,12 +1518,17 @@ NAPI_METHOD(regex_test) {
|
|
|
1513
1518
|
NAPI_STATUS_THROWS(GetValue(env, argv[3], length));
|
|
1514
1519
|
length = std::max(0, std::min<int>(length, value.size() - offset));
|
|
1515
1520
|
|
|
1516
|
-
|
|
1521
|
+
try {
|
|
1522
|
+
const bool match = std::regex_search(value.data() + offset, value.data() + offset + length, *regex);
|
|
1517
1523
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1524
|
+
napi_value result;
|
|
1525
|
+
NAPI_STATUS_THROWS(napi_get_boolean(env, match, &result));
|
|
1520
1526
|
|
|
1521
|
-
|
|
1527
|
+
return result;
|
|
1528
|
+
} catch (const std::exception& e) {
|
|
1529
|
+
napi_throw_error(env, nullptr, e.what());
|
|
1530
|
+
return 0;
|
|
1531
|
+
}
|
|
1522
1532
|
}
|
|
1523
1533
|
|
|
1524
1534
|
NAPI_METHOD(regex_test_many) {
|
|
@@ -1533,22 +1543,27 @@ NAPI_METHOD(regex_test_many) {
|
|
|
1533
1543
|
napi_value result;
|
|
1534
1544
|
NAPI_STATUS_THROWS(napi_create_array_with_length(env, count, &result));
|
|
1535
1545
|
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1546
|
+
try {
|
|
1547
|
+
for (uint32_t n = 0; n < count; n++) {
|
|
1548
|
+
napi_value valueElement;
|
|
1549
|
+
NAPI_STATUS_THROWS(napi_get_element(env, argv[1], n, &valueElement));
|
|
1539
1550
|
|
|
1540
|
-
|
|
1541
|
-
|
|
1551
|
+
rocksdb::Slice value;
|
|
1552
|
+
NAPI_STATUS_THROWS(GetValue(env, valueElement, value));
|
|
1542
1553
|
|
|
1543
|
-
|
|
1554
|
+
const bool match = std::regex_search(value.data(), value.data() + value.size(), *regex);
|
|
1544
1555
|
|
|
1545
|
-
|
|
1546
|
-
|
|
1556
|
+
napi_value matchElement;
|
|
1557
|
+
NAPI_STATUS_THROWS(napi_get_boolean(env, match, &matchElement));
|
|
1547
1558
|
|
|
1548
|
-
|
|
1549
|
-
|
|
1559
|
+
NAPI_STATUS_THROWS(napi_set_element(env, result, n, matchElement));
|
|
1560
|
+
}
|
|
1550
1561
|
|
|
1551
|
-
|
|
1562
|
+
return result;
|
|
1563
|
+
} catch (const std::exception& e) {
|
|
1564
|
+
napi_throw_error(env, nullptr, e.what());
|
|
1565
|
+
return 0;
|
|
1566
|
+
}
|
|
1552
1567
|
}
|
|
1553
1568
|
|
|
1554
1569
|
|
package/deps/rocksdb/rocksdb.gyp
CHANGED
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
"-momit-leaf-frame-pointer",
|
|
72
72
|
"-fno-builtin-memcmp"
|
|
73
73
|
],
|
|
74
|
-
"cflags": ["-std=c++20"],
|
|
74
|
+
"cflags": ["-std=c++20", "-march=znver1"],
|
|
75
75
|
"cflags!": ["-fno-rtti"],
|
|
76
76
|
"cflags_cc!": ["-fno-rtti"],
|
|
77
|
-
"cflags_cc+": ["-frtti"]
|
|
77
|
+
"cflags_cc+": ["-frtti", '-march=znver1']
|
|
78
78
|
}
|
|
79
79
|
],
|
|
80
80
|
[
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|