Mercurial > hg > index.cgi
changeset 521:56c32bc798f8
Fix argument parsing problems with IFSTR
Neglecting to take into account comma separators and opening delimiters led
to a number of off by one errors making IFSTR largely useless.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sun, 19 Dec 2021 17:46:02 -0700 |
parents | 63450eb68f45 |
children | 01bdad2118aa |
files | lwasm/pseudo.c |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/lwasm/pseudo.c Sun Dec 19 17:09:15 2021 -0700 +++ b/lwasm/pseudo.c Sun Dec 19 17:46:02 2021 -0700 @@ -1839,8 +1839,10 @@ if (tstr[i]) i++; + if (tstr[i] == ',') + i++; - *p += i; + *p += i + 1; return arg; } else if (*tstr == '\'') @@ -1856,8 +1858,9 @@ if (tstr[i]) i++; - - *p += i; + if (tstr[i] == ',') + i++; + *p += i + 1; return arg; } else @@ -1887,7 +1890,7 @@ arg1 = strcond_parsearg(p); arg2 = strcond_parsearg(p); - + if (strcmp(arg1, arg2) == 0) c = 1; lw_free(arg1);