Get rid of SStringPrintf().
Change-Id: I33eed8a36587cc94c9b196e951872ff1e5dcaaa4
Reviewed-on: https://code-review.googlesource.com/c/re2/+/43070
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/re2.cc b/re2/re2.cc
index 50e2c49..a4b4992 100644
--- a/re2/re2.cc
+++ b/re2/re2.cc
@@ -882,9 +882,10 @@
}
if (max_token > NumberOfCapturingGroups()) {
- SStringPrintf(error, "Rewrite schema requests %d matches, "
- "but the regexp only has %d parenthesized subexpressions.",
- max_token, NumberOfCapturingGroups());
+ *error = StringPrintf(
+ "Rewrite schema requests %d matches, but the regexp only has %d "
+ "parenthesized subexpressions.",
+ max_token, NumberOfCapturingGroups());
return false;
}
return true;
diff --git a/util/pcre.cc b/util/pcre.cc
index 93ac90c..5983c9f 100644
--- a/util/pcre.cc
+++ b/util/pcre.cc
@@ -734,9 +734,10 @@
}
if (max_token > NumberOfCapturingGroups()) {
- SStringPrintf(error, "Rewrite schema requests %d matches, "
- "but the regexp only has %d parenthesized subexpressions.",
- max_token, NumberOfCapturingGroups());
+ *error = StringPrintf(
+ "Rewrite schema requests %d matches, but the regexp only has %d "
+ "parenthesized subexpressions.",
+ max_token, NumberOfCapturingGroups());
return false;
}
return true;
diff --git a/util/strutil.cc b/util/strutil.cc
index cc3b857..d37aa0c 100644
--- a/util/strutil.cc
+++ b/util/strutil.cc
@@ -146,14 +146,6 @@
return result;
}
-void SStringPrintf(std::string* dst, const char* format, ...) {
- va_list ap;
- va_start(ap, format);
- dst->clear();
- StringAppendV(dst, format, ap);
- va_end(ap);
-}
-
void StringAppendF(std::string* dst, const char* format, ...) {
va_list ap;
va_start(ap, format);
diff --git a/util/strutil.h b/util/strutil.h
index b16981e..37fb359 100644
--- a/util/strutil.h
+++ b/util/strutil.h
@@ -15,7 +15,6 @@
std::string CEscape(const StringPiece& src);
void PrefixSuccessor(std::string* prefix);
std::string StringPrintf(const char* format, ...);
-void SStringPrintf(std::string* dst, const char* format, ...);
void StringAppendF(std::string* dst, const char* format, ...);
} // namespace re2