Tweak some printed debugging for style.

Change-Id: Idf26536195c850db997e0ab3fc7e25735028b54e
Reviewed-on: https://code-review.googlesource.com/c/re2/+/47630
Reviewed-by: Paul Wankadia <junyer@google.com>
diff --git a/re2/dfa.cc b/re2/dfa.cc
index 8631a2f..816080a 100644
--- a/re2/dfa.cc
+++ b/re2/dfa.cc
@@ -442,7 +442,7 @@
     q1_(NULL),
     mem_budget_(max_mem) {
   if (ExtraDebug)
-    fprintf(stderr, "\nkind %d\n%s\n", (int)kind_, prog_->DumpUnanchored().c_str());
+    fprintf(stderr, "\nkind %d\n%s\n", kind_, prog_->DumpUnanchored().c_str());
   int nmark = 0;
   if (kind_ == Prog::kLongestMatch)
     nmark = prog_->size();
@@ -989,8 +989,8 @@
   }
 
   if (ExtraDebug)
-    fprintf(stderr, "%s on %d[%#x] -> %s [%d]\n", DumpWorkq(oldq).c_str(),
-            c, flag, DumpWorkq(newq).c_str(), *ismatch);
+    fprintf(stderr, "%s on %d[%#x] -> %s [%d]\n",
+            DumpWorkq(oldq).c_str(), c, flag, DumpWorkq(newq).c_str(), *ismatch);
 }
 
 // Processes input byte c in state, returning new state.
@@ -1367,8 +1367,7 @@
 
   while (p != ep) {
     if (ExtraDebug)
-      fprintf(stderr, "@%td: %s\n",
-              p - bp, DumpState(s).c_str());
+      fprintf(stderr, "@%td: %s\n", p - bp, DumpState(s).c_str());
 
     if (have_first_byte && s == start) {
       // In start state, only way out is to find first_byte,
@@ -1476,8 +1475,7 @@
       else
         lastmatch = p + 1;
       if (ExtraDebug)
-        fprintf(stderr, "match @%td! [%s]\n",
-                lastmatch - bp, DumpState(s).c_str());
+        fprintf(stderr, "match @%td! [%s]\n", lastmatch - bp, DumpState(s).c_str());
       if (params->matches != NULL && kind_ == Prog::kManyMatch) {
         for (int i = s->ninst_ - 1; i >= 0; i--) {
           int id = s->inst_[i];
@@ -1780,8 +1778,7 @@
   if (ExtraDebug) {
     fprintf(stderr, "\nprogram:\n%s\n", prog_->DumpUnanchored().c_str());
     fprintf(stderr, "text %s anchored=%d earliest=%d fwd=%d kind %d\n",
-            std::string(text).c_str(), anchored, want_earliest_match,
-            run_forward, kind_);
+            std::string(text).c_str(), anchored, want_earliest_match, run_forward, kind_);
   }
 
   RWLocker l(&cache_mutex_);
diff --git a/re2/nfa.cc b/re2/nfa.cc
index 48e7119..3889f11 100644
--- a/re2/nfa.cc
+++ b/re2/nfa.cc
@@ -431,12 +431,12 @@
     if (capture[i] == NULL)
       s += "(?,?)";
     else if (capture[i+1] == NULL)
-      s += StringPrintf("(%d,?)",
-                        (int)(capture[i] - btext_));
+      s += StringPrintf("(%td,?)",
+                        capture[i] - btext_);
     else
-      s += StringPrintf("(%d,%d)",
-                        (int)(capture[i] - btext_),
-                        (int)(capture[i+1] - btext_));
+      s += StringPrintf("(%td,%td)",
+                        capture[i] - btext_,
+                        capture[i+1] - btext_);
   }
   return s;
 }
@@ -493,8 +493,7 @@
 
   if (ExtraDebug)
     fprintf(stderr, "NFA::Search %s (context: %s) anchored=%d longest=%d\n",
-            std::string(text).c_str(), std::string(context).c_str(), anchored,
-            longest);
+            std::string(text).c_str(), std::string(context).c_str(), anchored, longest);
 
   // Set up search.
   Threadq* runq = &q0_;
@@ -606,7 +605,8 @@
                       static_cast<size_t>(match_[2 * i + 1] - match_[2 * i]));
     if (ExtraDebug)
       fprintf(stderr, "match (%td,%td)\n",
-              match_[0] - btext_, match_[1] - btext_);
+              match_[0] - btext_,
+              match_[1] - btext_);
     return true;
   }
   return false;
diff --git a/re2/onepass.cc b/re2/onepass.cc
index 1b3f374..66a62d9 100644
--- a/re2/onepass.cc
+++ b/re2/onepass.cc
@@ -550,7 +550,7 @@
           if (!AddQ(&workq, ip->out())) {
             if (ExtraDebug)
               LOG(ERROR) << StringPrintf(
-                  "Not OnePass: multiple paths %d -> %d\n", *it, ip->out());
+                  "Not OnePass: multiple paths %d -> %d", *it, ip->out());
             goto fail;
           }
           id = ip->out();
@@ -561,7 +561,7 @@
             // (3) is violated
             if (ExtraDebug)
               LOG(ERROR) << StringPrintf(
-                  "Not OnePass: multiple matches from %d\n", *it);
+                  "Not OnePass: multiple matches from %d", *it);
             goto fail;
           }
           matched = true;
diff --git a/re2/testing/exhaustive_tester.cc b/re2/testing/exhaustive_tester.cc
index da0d436..bdac381 100644
--- a/re2/testing/exhaustive_tester.cc
+++ b/re2/testing/exhaustive_tester.cc
@@ -67,7 +67,8 @@
       printf("-");
     else
       printf("%td-%td",
-             m[i].begin() - input.begin(), m[i].end() - input.begin());
+             m[i].begin() - input.begin(),
+             m[i].end() - input.begin());
   }
 }
 
@@ -77,8 +78,9 @@
 void ExhaustiveTester::HandleRegexp(const std::string& const_regexp) {
   regexps_++;
   std::string regexp = const_regexp;
-  if (!topwrapper_.empty())
+  if (!topwrapper_.empty()) {
     regexp = StringPrintf(topwrapper_.c_str(), regexp.c_str());
+  }
 
   if (GetFlag(FLAGS_show_regexps)) {
     printf("\r%s", regexp.c_str());
diff --git a/re2/testing/regexp_benchmark.cc b/re2/testing/regexp_benchmark.cc
index 70c0e06..089d822 100644
--- a/re2/testing/regexp_benchmark.cc
+++ b/re2/testing/regexp_benchmark.cc
@@ -59,19 +59,22 @@
     CHECK(re);
     // Can't pass mc.HeapGrowth() and mc.PeakHeapGrowth() to LOG(INFO) directly,
     // because LOG(INFO) might do a big allocation before they get evaluated.
-    fprintf(stderr, "Regexp: %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "Regexp: %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     mc.Reset();
 
     Prog* prog = re->CompileToProg(0);
     CHECK(prog);
     CHECK(prog->IsOnePass());
     CHECK(prog->CanBitState());
-    fprintf(stderr, "Prog:   %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "Prog:   %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     mc.Reset();
 
     StringPiece sp[4];
     CHECK(prog->SearchOnePass(text, text, Prog::kAnchored, Prog::kFullMatch, sp, 4));
-    fprintf(stderr, "Search: %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "Search: %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     delete prog;
     re->Decref();
   }
@@ -80,18 +83,22 @@
     MallocCounter mc(MallocCounter::THIS_THREAD_ONLY);
 
     PCRE re(regexp, PCRE::UTF8);
-    fprintf(stderr, "RE:     %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "RE:     %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     PCRE::FullMatch(text, re);
-    fprintf(stderr, "RE:     %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "RE:     %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
   }
 
   {
     MallocCounter mc(MallocCounter::THIS_THREAD_ONLY);
 
     PCRE* re = new PCRE(regexp, PCRE::UTF8);
-    fprintf(stderr, "PCRE*:  %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "PCRE*:  %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     PCRE::FullMatch(text, *re);
-    fprintf(stderr, "PCRE*:  %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "PCRE*:  %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     delete re;
   }
 
@@ -99,9 +106,11 @@
     MallocCounter mc(MallocCounter::THIS_THREAD_ONLY);
 
     RE2 re(regexp);
-    fprintf(stderr, "RE2:    %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "RE2:    %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
     RE2::FullMatch(text, re);
-    fprintf(stderr, "RE2:    %7lld bytes (peak=%lld)\n", mc.HeapGrowth(), mc.PeakHeapGrowth());
+    fprintf(stderr, "RE2:    %7lld bytes (peak=%lld)\n",
+            mc.HeapGrowth(), mc.PeakHeapGrowth());
   }
 
   fprintf(stderr, "sizeof: PCRE=%zd RE2=%zd Prog=%zd Inst=%zd\n",
diff --git a/re2/testing/tester.cc b/re2/testing/tester.cc
index 18ced11..86eec53 100644
--- a/re2/testing/tester.cc
+++ b/re2/testing/tester.cc
@@ -103,7 +103,8 @@
   if (s.data() == NULL)
     return "(?,?)";
   return StringPrintf("(%td,%td)",
-                      s.begin() - text.begin(), s.end() - text.begin());
+                      s.begin() - text.begin(),
+                      s.end() - text.begin());
 }
 
 // Returns whether text contains non-ASCII (>= 0x80) bytes.