parsing needs to return a static buffer if it has no argument

This commit is contained in:
Enno Rehling 2014-12-29 07:44:00 +01:00
parent 6ffec7017c
commit 43351e03cd
1 changed files with 3 additions and 4 deletions

View File

@ -201,16 +201,15 @@ char *parse_token(const char **str, char *lbuf, size_t buflen)
return lbuf; return lbuf;
} }
static char pbuf[MAXTOKENSIZE]; /* STATIC_RESULT: used for return, not across calls */
const char *parse_token_depr(const char **str) const char *parse_token_depr(const char **str)
{ {
static char lbuf[MAXTOKENSIZE]; /* STATIC_RESULT: used for return, not across calls */ return parse_token(str, pbuf, MAXTOKENSIZE);
return parse_token(str, lbuf, MAXTOKENSIZE);
} }
const char *getstrtoken(void) const char *getstrtoken(void)
{ {
char lbuf[MAXTOKENSIZE]; return parse_token((const char **)&states->current_token, pbuf, MAXTOKENSIZE);
return parse_token((const char **)&states->current_token, lbuf, MAXTOKENSIZE);
} }
const char *gettoken(char *lbuf, size_t bufsize) const char *gettoken(char *lbuf, size_t bufsize)