nupa_substitute(), postpone `s' incrementation

This commit is contained in:
rlar 2016-05-14 15:52:34 +02:00
parent 39b544aba1
commit ad1eeeb410
1 changed files with 4 additions and 5 deletions

View File

@ -1239,13 +1239,12 @@ nupa_substitute(dico_t *dico, const char *s, char *r)
continue; continue;
} }
s++; while ((s < s_end - 1) && (*s <= ' '))
while ((s < s_end) && (s[-1] <= ' '))
s++; s++;
if (s[-1] == '(') { if (*s == '(') {
/* sub-formula */ /* sub-formula */
const char *kptr = s; const char *kptr = ++s;
int level = 1; int level = 1;
for (; kptr < s_end; kptr++) { for (; kptr < s_end; kptr++) {
@ -1272,7 +1271,7 @@ nupa_substitute(dico_t *dico, const char *s, char *r)
} else { } else {
/* simple identifier may also be string? */ /* simple identifier may also be string? */
const char *kptr = s; const char *kptr = ++s;
for (; kptr < s_end; kptr++) for (; kptr < s_end; kptr++)
if (*kptr <= ' ') if (*kptr <= ' ')
break; break;