summaryrefslogtreecommitdiffstats
path: root/mfbt/double-conversion/debug-only-functions.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /mfbt/double-conversion/debug-only-functions.patch
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mfbt/double-conversion/debug-only-functions.patch')
-rw-r--r--mfbt/double-conversion/debug-only-functions.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/mfbt/double-conversion/debug-only-functions.patch b/mfbt/double-conversion/debug-only-functions.patch
new file mode 100644
index 0000000000..3988eaad56
--- /dev/null
+++ b/mfbt/double-conversion/debug-only-functions.patch
@@ -0,0 +1,39 @@
+diff --git a/mfbt/double-conversion/double-conversion/strtod.cc b/mfbt/double-conversion/double-conversion/strtod.cc
+--- a/mfbt/double-conversion/double-conversion/strtod.cc
++++ b/mfbt/double-conversion/double-conversion/strtod.cc
+@@ -436,16 +436,17 @@ static bool ComputeGuess(Vector<const ch
+ return true;
+ }
+ if (*guess == Double::Infinity()) {
+ return true;
+ }
+ return false;
+ }
+
++#ifdef DEBUG
+ static bool IsDigit(const char d) {
+ return ('0' <= d) && (d <= '9');
+ }
+
+ static bool IsNonZeroDigit(const char d) {
+ return ('1' <= d) && (d <= '9');
+ }
+
+@@ -457,16 +458,17 @@ static bool IsNonZeroDigit(const char d)
+ static bool AssertTrimmedDigits(const Vector<const char>& buffer) {
+ for(int i = 0; i < buffer.length(); ++i) {
+ if(!IsDigit(buffer[i])) {
+ return false;
+ }
+ }
+ return (buffer.length() == 0) || (IsNonZeroDigit(buffer[0]) && IsNonZeroDigit(buffer[buffer.length()-1]));
+ }
++#endif
+
+ double StrtodTrimmed(Vector<const char> trimmed, int exponent) {
+ DOUBLE_CONVERSION_ASSERT(trimmed.length() <= kMaxSignificantDecimalDigits);
+ DOUBLE_CONVERSION_ASSERT(AssertTrimmedDigits(trimmed));
+ double guess;
+ const bool is_correct = ComputeGuess(trimmed, exponent, &guess);
+ if (is_correct) {
+ return guess;