Bug 842886: Initialize & compare size_t variables to SIZE_MAX instead of -1 in Debugger.cpp. r=ejpbruel
authorDaniel Holbert <dholbert@cs.stanford.edu>
Tue, 19 Feb 2013 23:20:14 -0800
changeset 122404 9811bb0806fc74d0630d99cb7c11b430fc7a5512
parent 122403 c9840572966bf99aedd7f1cb42d8df6f27be5654
child 122405 1bcc3c56b011fe85db8b70641cf4f13da3c93547
push id24336
push userryanvm@gmail.com
push dateWed, 20 Feb 2013 12:07:46 +0000
treeherdermozilla-central@1bcc3c56b011 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersejpbruel
bugs842886
milestone22.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 842886: Initialize & compare size_t variables to SIZE_MAX instead of -1 in Debugger.cpp. r=ejpbruel
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -1,15 +1,17 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * vim: set ts=4 sw=4 et tw=99 ft=cpp:
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+#include <limits.h>
+
 #include "vm/Debugger.h"
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jsnum.h"
 #include "jsobj.h"
 #include "jswrapper.h"
 #include "jsgcinlines.h"
 #include "jsinterpinlines.h"
@@ -2987,47 +2989,47 @@ class BytecodeRangeWithPosition : privat
  *       instruction is on, so the instruction is an entry point for that
  *       position.
  */
 class FlowGraphSummary {
   public:
     class Entry {
       public:
         static Entry createWithNoEdges() {
-            return Entry(-1, 0);
+            return Entry(SIZE_MAX, 0);
         }
 
         static Entry createWithSingleEdge(size_t lineno, size_t column) {
             return Entry(lineno, column);
         }
 
         static Entry createWithMultipleEdgesFromSingleLine(size_t lineno) {
-            return Entry(lineno, -1);
+            return Entry(lineno, SIZE_MAX);
         }
 
         static Entry createWithMultipleEdgesFromMultipleLines() {
-            return Entry(-1, -1);
+            return Entry(SIZE_MAX, SIZE_MAX);
         }
 
         Entry() {}
 
         bool hasNoEdges() const {
-            return lineno_ == -1 && column_ != -1;
+            return lineno_ == SIZE_MAX && column_ != SIZE_MAX;
         }
 
         bool hasSingleEdge() const {
-            return lineno_ != -1 && column_ != -1;
+            return lineno_ != SIZE_MAX && column_ != SIZE_MAX;
         }
 
         bool hasMultipleEdgesFromSingleLine() const {
-            return lineno_ != -1 && column_ == -1;
+            return lineno_ != SIZE_MAX && column_ == SIZE_MAX;
         }
 
         bool hasMultipleEdgesFromMultipleLines() const {
-            return lineno_ == -1 && column_ == -1;
+            return lineno_ == SIZE_MAX && column_ == SIZE_MAX;
         }
 
         bool operator==(const Entry &other) const {
             return lineno_ == other.lineno_ && column_ == other.column_;
         }
 
         bool operator!=(const Entry &other) const {
             return lineno_ != other.lineno_ || column_ != other.column_;