summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/internal/gtest-port.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-02-15 23:21:19 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-02-15 23:22:10 (GMT)
commitf063cd25c90cbd4089a0ff96f5991df4f2721338 (patch)
tree5bad6a1e75e225fbac4d79058c13fe05ef78e151 /googletest/include/gtest/internal/gtest-port.h
parent2057566e4e16c88f1fea4d6c96b2e2bfb87507a6 (diff)
downloadgoogletest-f063cd25c90cbd4089a0ff96f5991df4f2721338.zip
googletest-f063cd25c90cbd4089a0ff96f5991df4f2721338.tar.gz
googletest-f063cd25c90cbd4089a0ff96f5991df4f2721338.tar.bz2
Remove strdup usage
PiperOrigin-RevId: 509947007 Change-Id: I31e1274afa889776829c877c40c9af589298dcf2
Diffstat (limited to 'googletest/include/gtest/internal/gtest-port.h')
-rw-r--r--googletest/include/gtest/internal/gtest-port.h17
1 files changed, 3 insertions, 14 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index bedd67d..ae7fb35 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -923,7 +923,7 @@ class GTEST_API_ RE {
~RE();
// Returns the string representation of the regex.
- const char* pattern() const { return pattern_; }
+ const char* pattern() const { return pattern_.c_str(); }
// FullMatch(str, re) returns true if and only if regular expression re
// matches the entire str.
@@ -941,7 +941,7 @@ class GTEST_API_ RE {
private:
void Init(const char* regex);
- const char* pattern_;
+ std::string pattern_;
bool is_valid_;
#if GTEST_USES_POSIX_RE
@@ -951,7 +951,7 @@ class GTEST_API_ RE {
#else // GTEST_USES_SIMPLE_RE
- const char* full_pattern_; // For FullMatch();
+ std::string full_pattern_; // For FullMatch();
#endif
};
@@ -2032,7 +2032,6 @@ inline int DoIsATTY(int fd) { return isatty(fd); }
inline int StrCaseCmp(const char* s1, const char* s2) {
return stricmp(s1, s2);
}
-inline char* StrDup(const char* src) { return strdup(src); }
#else // !__BORLANDC__
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_ZOS || GTEST_OS_IOS || \
GTEST_OS_WINDOWS_PHONE || GTEST_OS_WINDOWS_RT || defined(ESP_PLATFORM)
@@ -2043,24 +2042,14 @@ inline int DoIsATTY(int fd) { return _isatty(fd); }
inline int StrCaseCmp(const char* s1, const char* s2) {
return _stricmp(s1, s2);
}
-inline char* StrDup(const char* src) { return _strdup(src); }
#endif // __BORLANDC__
-#elif GTEST_OS_ESP8266
-
-inline int DoIsATTY(int fd) { return isatty(fd); }
-inline int StrCaseCmp(const char* s1, const char* s2) {
- return strcasecmp(s1, s2);
-}
-inline char* StrDup(const char* src) { return strdup(src); }
-
#else
inline int DoIsATTY(int fd) { return isatty(fd); }
inline int StrCaseCmp(const char* s1, const char* s2) {
return strcasecmp(s1, s2);
}
-inline char* StrDup(const char* src) { return strdup(src); }
#endif // GTEST_OS_WINDOWS