changeset 33242:432e0151f652

* lex.ll: Replace remaining uses of assert with panic_unless.
author John W. Eaton <jwe@octave.org>
date Sat, 23 Mar 2024 13:02:24 -0400
parents 4e5bc9c4f657
children d9ed1a322311
files libinterp/parse-tree/lex.ll
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/lex.ll	Sat Mar 23 12:13:17 2024 -0400
+++ b/libinterp/parse-tree/lex.ll	Sat Mar 23 13:02:24 2024 -0400
@@ -2358,7 +2358,7 @@
     else
       len = max_size > m_chars_left ? m_chars_left : max_size;
 
-    assert (len > 0);
+    panic_unless (len > 0);
     memcpy (buf, m_buffer.c_str () + m_offset, len);
 
     m_chars_left -= len;
@@ -3106,9 +3106,10 @@
 
     nread = sscanf (tmptxt, "%lf", &value);
 
-    // If yytext doesn't contain a valid number, we are in deep doo doo.
-
-    assert (nread == 1);
+    // Panic instead of error because if yytext doesn't contain a valid
+    // number, we are in deep doo doo.
+
+    panic_unless (nread == 1);
 
     octave_value ov_value;
 
@@ -3213,12 +3214,12 @@
         return syntax_error (msg);
       }
 
-    // Assert here because if yytext doesn't contain a valid number, we
-    // are in deep doo doo.
+    // Panic instead of error here because if yytext doesn't contain a
+    // valid number, we are in deep doo doo.
 
     uintmax_t long_int_val;
     int status = sscanf (yytxt.c_str (), "%jx", &long_int_val);
-    assert (status);
+    panic_unless (status);
 
     octave_value ov_value
       = make_integer_value (long_int_val, unsigned_val, bytes);
@@ -4052,7 +4053,7 @@
         // input_buffer::copy_chunk, simply insert the marker directly
         // in BUF.
 
-        assert (max_size > 0);
+        panic_unless (max_size > 0);
 
         buf[0] = static_cast<char> (1);
         status = 1;