From 0db8d3b956a7f4f73d4c47fa11370b512bd0584c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 12 Aug 2023 14:55:48 +0200 Subject: [PATCH] Reemove needless code, check for '}0', don't do anything here if not true m=something --- src/frontend/inpcom.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index c871e58e4..ebe3f319b 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -5556,18 +5556,18 @@ static char* eval_m(char* line, char* tline) { double m; char* str_ptr, * m_ptr, * m_str = NULL; char* cut_line = line; - str_ptr = strstr(cut_line, "m="); + str_ptr = strstr(cut_line, " m="); if (str_ptr) { /* We need to have 'm=something */ - if (str_ptr[2]) { - m_ptr = str_ptr + 2; + if (str_ptr[3]) { + m_ptr = str_ptr + 3; int error = 0; m = INPevaluate(&m_ptr, &error, 1); /*We have a value and create the m string */ if (error == 0) { m_str = tprintf("m=%15.8e", m); } - else if (error == 1 && *m_ptr == '{' && m_ptr + 1 && *(m_ptr + 1) != '}') { + else if (error == 1 && *m_ptr == '{' && *(m_ptr + 1) != '\0' && *(m_ptr + 1) != '}') { char* bra = gettok_char(&m_ptr, '}', TRUE, TRUE); if (bra) { m_str = tprintf("m=%s", bra); @@ -5598,18 +5598,18 @@ static char* eval_mvalue(char* line, char* tline) { double m; char* str_ptr, * m_ptr, * m_str = NULL; char* cut_line = line; - str_ptr = strstr(cut_line, "m="); + str_ptr = strstr(cut_line, " m="); if (str_ptr) { /* We need to have 'm=something */ - if (str_ptr[2]) { - m_ptr = str_ptr + 2; + if (str_ptr[3]) { + m_ptr = str_ptr + 3; int error = 0; m = INPevaluate(&m_ptr, &error, 1); /*We have a value and create the m string */ if (error == 0) { m_str = tprintf("%15.8e", m); } - else if (error == 1 && *m_ptr == '{' && m_ptr + 1 && *(m_ptr + 1) != '}') { + else if (error == 1 && *m_ptr == '{' && *(m_ptr + 1) != '\0' && *(m_ptr + 1) != '}') { char* bra = gettok_char(&m_ptr, '}', TRUE, TRUE); if (bra) { m_str = tprintf("%s", bra);