Address some clang-tidy gripes.
Change-Id: I9cc48dc0619a6903c1b9f1f3a734e366c4e764a6
Reviewed-on: https://code-review.googlesource.com/c/re2/+/40010
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/re2.h b/re2/re2.h
index 09f9e67..c39589d 100644
--- a/re2/re2.h
+++ b/re2/re2.h
@@ -305,13 +305,13 @@
// useful to invoke them directly, but the syntax is awkward, so the 'N'-less
// versions should be preferred.
static bool FullMatchN(const StringPiece& text, const RE2& re,
- const Arg* const args[], int argc);
+ const Arg* const args[], int n);
static bool PartialMatchN(const StringPiece& text, const RE2& re,
- const Arg* const args[], int argc);
+ const Arg* const args[], int n);
static bool ConsumeN(StringPiece* input, const RE2& re,
- const Arg* const args[], int argc);
+ const Arg* const args[], int n);
static bool FindAndConsumeN(StringPiece* input, const RE2& re,
- const Arg* const args[], int argc);
+ const Arg* const args[], int n);
#ifndef SWIG
private:
@@ -323,8 +323,8 @@
template <typename F, typename SP, typename... A>
static inline bool Apply(F f, SP sp, const RE2& re, const A&... a) {
const Arg* const args[] = {&a...};
- const int argc = sizeof...(a);
- return f(sp, re, args, argc);
+ const int n = sizeof...(a);
+ return f(sp, re, args, n);
}
public:
diff --git a/re2/testing/re2_test.cc b/re2/testing/re2_test.cc
index 2d692a6..52c9294 100644
--- a/re2/testing/re2_test.cc
+++ b/re2/testing/re2_test.cc
@@ -1461,9 +1461,8 @@
EXPECT_TRUE(re.Match(null, 0, null.size(), RE2::UNANCHORED,
matches, arraysize(matches)));
for (int i = 0; i < arraysize(matches); i++) {
- EXPECT_TRUE(matches[i] == StringPiece());
EXPECT_TRUE(matches[i].data() == NULL); // always null
- EXPECT_TRUE(matches[i] == "");
+ EXPECT_TRUE(matches[i].empty());
}
for (int i = 0; i < arraysize(matches); i++)
@@ -1472,18 +1471,14 @@
StringPiece empty("");
EXPECT_TRUE(re.Match(empty, 0, empty.size(), RE2::UNANCHORED,
matches, arraysize(matches)));
- EXPECT_TRUE(matches[0] == StringPiece());
EXPECT_TRUE(matches[0].data() != NULL); // empty, not null
- EXPECT_TRUE(matches[0] == "");
- EXPECT_TRUE(matches[1] == StringPiece());
+ EXPECT_TRUE(matches[0].empty());
EXPECT_TRUE(matches[1].data() != NULL); // empty, not null
- EXPECT_TRUE(matches[1] == "");
- EXPECT_TRUE(matches[2] == StringPiece());
+ EXPECT_TRUE(matches[1].empty());
EXPECT_TRUE(matches[2].data() == NULL);
- EXPECT_TRUE(matches[2] == "");
- EXPECT_TRUE(matches[3] == StringPiece());
+ EXPECT_TRUE(matches[2].empty());
EXPECT_TRUE(matches[3].data() == NULL);
- EXPECT_TRUE(matches[3] == "");
+ EXPECT_TRUE(matches[3].empty());
}
// Issue 1816809