Bug 1528322 - Use a ranged for loop to iterate over chars array, as suggested by static analysis. r=gerald
authorMarkus Stange <mstange@themasta.com>
Fri, 15 Feb 2019 20:51:58 +0000
changeset 459606 8da76935aebee58a00ce47e9f36dbe65e495ab93
parent 459605 96a79763127db3305ed33aba21d774bdbe5331da
child 459607 b99e716549211d24dcf69e9b4969b88765afdb56
push id35563
push userccoroiu@mozilla.com
push dateSat, 16 Feb 2019 09:36:04 +0000
treeherdermozilla-central@1cfd69d05aa1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1528322
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1528322 - Use a ranged for loop to iterate over chars array, as suggested by static analysis. r=gerald Differential Revision: https://phabricator.services.mozilla.com/D19966
tools/profiler/core/ProfileBufferEntry.cpp
--- a/tools/profiler/core/ProfileBufferEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -1012,19 +1012,19 @@ void ProfileBuffer::StreamSamplesToJSON(
         // Copy potential dynamic string fragments into dynStrBuf, so that
         // dynStrBuf will then contain the entire dynamic string.
         size_t i = 0;
         dynStrBuf[0] = '\0';
         while (e.Has()) {
           if (e.Get().IsDynamicStringFragment()) {
             char chars[ProfileBufferEntry::kNumChars];
             e.Get().CopyCharsInto(chars);
-            for (size_t j = 0; j < ProfileBufferEntry::kNumChars; j++) {
+            for (char c : chars) {
               if (i < kMaxFrameKeyLength) {
-                dynStrBuf[i] = chars[j];
+                dynStrBuf[i] = c;
                 i++;
               }
             }
             e.Next();
           } else {
             break;
           }
         }