Commit 448f1272 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 4

Start compiling a bit of `-Wshadow`

Summary: Sometimes variable shadowing is fine, sometimes it can cause subtle mistakes.

Reviewed By: yfeldblum

Differential Revision: D3140450

fb-gh-sync-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
fbshipit-source-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
parent 177753d9
......@@ -214,11 +214,11 @@ void FormatArg::initSlow() {
}
auto readInt = [&] {
auto const b = p;
auto const c = p;
do {
++p;
} while (p != end && *p >= '0' && *p <= '9');
return to<int>(StringPiece(b, p));
return to<int>(StringPiece(c, p));
};
if (*p == '*') {
......@@ -242,12 +242,12 @@ void FormatArg::initSlow() {
}
if (*p == '.') {
auto b = ++p;
auto d = ++p;
while (p != end && *p >= '0' && *p <= '9') {
++p;
}
if (p != b) {
precision = to<int>(StringPiece(b, p));
if (p != d) {
precision = to<int>(StringPiece(d, p));
if (p != end && *p == '.') {
trailingDot = true;
++p;
......
......@@ -36,7 +36,7 @@ namespace {
* A structure to free a struct addrinfo when it goes out of scope.
*/
struct ScopedAddrInfo {
explicit ScopedAddrInfo(struct addrinfo* info) : info(info) {}
explicit ScopedAddrInfo(struct addrinfo* addrinfo) : info(addrinfo) {}
~ScopedAddrInfo() {
freeaddrinfo(info);
}
......
......@@ -115,11 +115,9 @@ size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
// Now, we can do aligned loads hereafter...
size_t i = nextAlignedIndex(haystack.data());
for (; i < haystack.size(); i+= 16) {
auto arr1 = _mm_load_si128(
reinterpret_cast<const __m128i*>(haystack.data() + i));
auto index = _mm_cmpestri(
arr2, needles.size(),
arr1, haystack.size() - i, 0);
arr1 =
_mm_load_si128(reinterpret_cast<const __m128i*>(haystack.data() + i));
index = _mm_cmpestri(arr2, needles.size(), arr1, haystack.size() - i, 0);
if (index < 16) {
return i + index;
}
......@@ -211,7 +209,7 @@ size_t qfind_first_byte_of_sse42(const StringPieceLite haystack,
size_t i = nextAlignedIndex(haystack.data());
for (; i < haystack.size(); i += 16) {
auto ret = scanHaystackBlock<true>(haystack, needles, i);
ret = scanHaystackBlock<true>(haystack, needles, i);
if (ret != std::string::npos) {
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment