changed code from while to do/while

This commit is contained in:
Denis Ahrens 2015-10-12 06:04:22 +02:00
parent 4876bda857
commit 067dc50efe

View File

@ -499,9 +499,9 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
} }
} }
else if(l_isdigit(c)) { else if(l_isdigit(c)) {
c = lex_get_save(lex, error); do
while(l_isdigit(c))
c = lex_get_save(lex, error); c = lex_get_save(lex, error);
while(l_isdigit(c));
} }
else { else {
lex_unget_unsave(lex, c); lex_unget_unsave(lex, c);
@ -542,9 +542,9 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
} }
lex_save(lex, c); lex_save(lex, c);
c = lex_get_save(lex, error); do
while(l_isdigit(c))
c = lex_get_save(lex, error); c = lex_get_save(lex, error);
while(l_isdigit(c));
} }
if(c == 'E' || c == 'e') { if(c == 'E' || c == 'e') {
@ -557,9 +557,9 @@ static int lex_scan_number(lex_t *lex, int c, json_error_t *error)
goto out; goto out;
} }
c = lex_get_save(lex, error); do
while(l_isdigit(c))
c = lex_get_save(lex, error); c = lex_get_save(lex, error);
while(l_isdigit(c));
} }
lex_unget_unsave(lex, c); lex_unget_unsave(lex, c);
@ -586,9 +586,9 @@ static int lex_scan(lex_t *lex, json_error_t *error)
if(lex->token == TOKEN_STRING) if(lex->token == TOKEN_STRING)
lex_free_string(lex); lex_free_string(lex);
c = lex_get(lex, error); do
while(c == ' ' || c == '\t' || c == '\n' || c == '\r')
c = lex_get(lex, error); c = lex_get(lex, error);
while(c == ' ' || c == '\t' || c == '\n' || c == '\r');
if(c == STREAM_STATE_EOF) { if(c == STREAM_STATE_EOF) {
lex->token = TOKEN_EOF; lex->token = TOKEN_EOF;
@ -617,9 +617,9 @@ static int lex_scan(lex_t *lex, json_error_t *error)
/* eat up the whole identifier for clearer error messages */ /* eat up the whole identifier for clearer error messages */
const char *saved_text; const char *saved_text;
c = lex_get_save(lex, error); do
while(l_isalpha(c))
c = lex_get_save(lex, error); c = lex_get_save(lex, error);
while(l_isalpha(c));
lex_unget_unsave(lex, c); lex_unget_unsave(lex, c);
saved_text = strbuffer_value(&lex->saved_text); saved_text = strbuffer_value(&lex->saved_text);