aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-01 19:39:52 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-12-01 19:39:52 +0000
commit891b3716c4b6e4bd7fdbd642ecaab37776eb5935 (patch)
tree44da89de56dcc1958fdc443d2c07befe35c2ace2 /src
parent2e075a7f60da95cd02a3935fda49d222a435d56a (diff)
downloadgoogletest-891b3716c4b6e4bd7fdbd642ecaab37776eb5935.tar.gz
googletest-891b3716c4b6e4bd7fdbd642ecaab37776eb5935.tar.bz2
googletest-891b3716c4b6e4bd7fdbd642ecaab37776eb5935.zip
Exposes SkipPrefix s.t. it can be used by gmock (by Vlad Losev).
Diffstat (limited to 'src')
-rw-r--r--src/gtest.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gtest.cc b/src/gtest.cc
index 55861544..aa50b25b 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -4355,6 +4355,18 @@ bool AlwaysTrue() {
return true;
}
+// If *pstr starts with the given prefix, modifies *pstr to be right
+// past the prefix and returns true; otherwise leaves *pstr unchanged
+// and returns false. None of pstr, *pstr, and prefix can be NULL.
+bool SkipPrefix(const char* prefix, const char** pstr) {
+ const size_t prefix_len = strlen(prefix);
+ if (strncmp(*pstr, prefix, prefix_len) == 0) {
+ *pstr += prefix_len;
+ return true;
+ }
+ return false;
+}
+
// Parses a string as a command line flag. The string should have
// the format "--flag=value". When def_optional is true, the "=value"
// part can be omitted.
@@ -4444,18 +4456,6 @@ bool ParseStringFlag(const char* str, const char* flag, String* value) {
return true;
}
-// Determines whether a string pointed by *str has the prefix parameter as
-// its prefix and advances it to point past the prefix if it does.
-static bool SkipPrefix(const char* prefix, const char** str) {
- const size_t prefix_len = strlen(prefix);
-
- if (strncmp(*str, prefix, prefix_len) != 0)
- return false;
-
- *str += prefix_len;
- return true;
-}
-
// Determines whether a string has a prefix that Google Test uses for its
// flags, i.e., starts with GTEST_FLAG_PREFIX_ or GTEST_FLAG_PREFIX_DASH_.
// If Google Test detects that a command line flag has its prefix but is not