| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d2fef4a commit 241a6b7
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1515,13 +1515,13 @@ class [[nodiscard]] ThreadWithParam : public ThreadWithParamBase { | |||
| 1515 | 1515 | ||
| 1516 | 1516 | ThreadWithParam(UserThreadFunc* func, T param, Notification* thread_can_start) | |
| 1517 | 1517 | : ThreadWithParamBase(new RunnableImpl(func, param), thread_can_start) {} | |
| 1518 | - ~ThreadWithParam() override {} | ||
| 1518 | + ~ThreadWithParam() override = default; | ||
| 1519 | 1519 | ||
| 1520 | 1520 | private: | |
| 1521 | 1521 | class RunnableImpl : public Runnable { | |
| 1522 | 1522 | public: | |
| 1523 | 1523 | RunnableImpl(UserThreadFunc* func, T param) : func_(func), param_(param) {} | |
| 1524 | - ~RunnableImpl() override {} | ||
| 1524 | + ~RunnableImpl() override = default; | ||
| 1525 | 1525 | void Run() override { func_(param_); } | |
| 1526 | 1526 | ||
| 1527 | 1527 | private: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -89,6 +89,7 @@ | |||
| 89 | 89 | ||
| 90 | 90 | #include "gtest/gtest-message.h" | |
| 91 | 91 | #include "gtest/gtest-spi.h" | |
| 92 | + #include "gtest/gtest.h" | ||
| 92 | 93 | #include "gtest/internal/gtest-internal.h" | |
| 93 | 94 | #include "gtest/internal/gtest-string.h" | |
| 94 | 95 | #include "src/gtest-internal-inl.h" | |
@@ -729,7 +730,7 @@ void RE::Init(const char* regex) { | |||
| 729 | 730 | char* const full_pattern = new char[full_regex_len]; | |
| 730 | 731 | ||
| 731 | 732 | snprintf(full_pattern, full_regex_len, "^(%s)$", regex); | |
| 732 | - is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0; | ||
| 733 | + int error = regcomp(&full_regex_, full_pattern, reg_flags); | ||
| 733 | 734 | // We want to call regcomp(&partial_regex_, ...) even if the | |
| 734 | 735 | // previous expression returns false. Otherwise partial_regex_ may | |
| 735 | 736 | // not be properly initialized can may cause trouble when it's | |
@@ -738,13 +739,13 @@ void RE::Init(const char* regex) { | |||
| 738 | 739 | // Some implementation of POSIX regex (e.g. on at least some | |
| 739 | 740 | // versions of Cygwin) doesn't accept the empty string as a valid | |
| 740 | 741 | // regex. We change it to an equivalent form "()" to be safe. | |
| 741 | - if (is_valid_) { | ||
| 742 | + if (!error) { | ||
| 742 | 743 | const char* const partial_regex = (*regex == '\0') ? "()" : regex; | |
| 743 | - is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0; | ||
| 744 | + error = regcomp(&partial_regex_, partial_regex, reg_flags); | ||
| 744 | 745 | } | |
| 745 | - EXPECT_TRUE(is_valid_) | ||
| 746 | - << "Regular expression \"" << regex | ||
| 747 | - << "\" is not a valid POSIX Extended regular expression."; | ||
| 746 | + is_valid_ = error == 0; | ||
| 747 | + EXPECT_EQ(error, 0) << "Regular expression \"" << regex | ||
| 748 | + << "\" is not a valid POSIX Extended regular expression."; | ||
| 748 | 749 | ||
| 749 | 750 | delete[] full_pattern; | |
| 750 | 751 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments