| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -697,13 +697,24 @@ bool RE::PartialMatch(const char* str, const RE& re) { | |||
| 697 | 697 | void RE::Init(const char* regex) { | |
| 698 | 698 | pattern_ = regex; | |
| 699 | 699 | ||
| 700 | + // NetBSD (and Android, which takes its regex implemntation from NetBSD) does | ||
| 701 | + // not include the GNU regex extensions (such as Perl style character classes | ||
| 702 | + // like \w) in REG_EXTENDED. REG_EXTENDED is only specified to include the | ||
| 703 | + // [[:alpha:]] style character classes. Enable REG_GNU wherever it is defined | ||
| 704 | + // so users can use those extensions. | ||
| 705 | + #if defined(REG_GNU) | ||
| 706 | + constexpr int reg_flags = REG_EXTENDED | REG_GNU; | ||
| 707 | + #else | ||
| 708 | + constexpr int reg_flags = REG_EXTENDED; | ||
| 709 | + #endif | ||
| 710 | + | ||
| 700 | 711 | // Reserves enough bytes to hold the regular expression used for a | |
| 701 | 712 | // full match. | |
| 702 | 713 | const size_t full_regex_len = strlen(regex) + 10; | |
| 703 | 714 | char* const full_pattern = new char[full_regex_len]; | |
| 704 | 715 | ||
| 705 | 716 | snprintf(full_pattern, full_regex_len, "^(%s)$", regex); | |
| 706 | - is_valid_ = regcomp(&full_regex_, full_pattern, REG_EXTENDED) == 0; | ||
| 717 | + is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0; | ||
| 707 | 718 | // We want to call regcomp(&partial_regex_, ...) even if the | |
| 708 | 719 | // previous expression returns false. Otherwise partial_regex_ may | |
| 709 | 720 | // not be properly initialized can may cause trouble when it's | |
@@ -714,7 +725,7 @@ void RE::Init(const char* regex) { | |||
| 714 | 725 | // regex. We change it to an equivalent form "()" to be safe. | |
| 715 | 726 | if (is_valid_) { | |
| 716 | 727 | const char* const partial_regex = (*regex == '\0') ? "()" : regex; | |
| 717 | - is_valid_ = regcomp(&partial_regex_, partial_regex, REG_EXTENDED) == 0; | ||
| 728 | + is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0; | ||
| 718 | 729 | } | |
| 719 | 730 | EXPECT_TRUE(is_valid_) | |
| 720 | 731 | << "Regular expression \"" << regex | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -15,7 +15,7 @@ This a list of all the dependencies: | |||
| 15 | 15 | * [c-ares 1.20.1][] | |
| 16 | 16 | * [cjs-module-lexer][] | |
| 17 | 17 | * [corepack][] | |
| 18 | - * [googletest e47544a][] | ||
| 18 | + * [googletest 2dd1c13][] | ||
| 19 | 19 | * [histogram][] | |
| 20 | 20 | * [icu-small][] | |
| 21 | 21 | * [llhttp][] | |
@@ -187,7 +187,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to | |||
| 187 | 187 | install them - just like what currently happens with npm, which is shipped | |
| 188 | 188 | by Node.js by default. | |
| 189 | 189 | ||
| 190 | - ### googletest e47544a | ||
| 190 | + ### googletest 2dd1c13 | ||
| 191 | 191 | ||
| 192 | 192 | The [googletest](https://github.com/google/googletest) dependency is Google’s | |
| 193 | 193 | C++ testing and mocking framework. | |
@@ -319,7 +319,7 @@ performance improvements not currently available in standard zlib. | |||
| 319 | 319 | [cjs-module-lexer]: #cjs-module-lexer | |
| 320 | 320 | [corepack]: #corepack | |
| 321 | 321 | [dependency-update-action]: ../../../.github/workflows/tools.yml | |
| 322 | - [googletest e47544a]: #googletest-e47544a | ||
| 322 | + [googletest 2dd1c13]: #googletest-2dd1c13 | ||
| 323 | 323 | [histogram]: #histogram | |
| 324 | 324 | [icu-small]: #icu-small | |
| 325 | 325 | [llhttp]: #llhttp | |
| Back | FazBrowse Home | New Git URL |
0 commit comments