# HG changeset patch # User John W. Eaton # Date 1711213344 14400 # Node ID 432e0151f65221c9c87b424a19e49f5065ccea8f # Parent 4e5bc9c4f6572c20c1a52745e71ca5ebba17fafe * lex.ll: Replace remaining uses of assert with panic_unless. diff -r 4e5bc9c4f657 -r 432e0151f652 libinterp/parse-tree/lex.ll --- 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 (1); status = 1;