ps->po_lex_obsolete = false;
ps->po_lex_previous = false;
po_lex_charset_init (ps);
+ ps->buf = NULL;
+ ps->bufmax = 0;
}
/* Terminate lexical analysis. */
gram_pos.file_name = NULL;
gram_pos.line_number = 0;
po_lex_charset_close (ps);
+ free (ps->buf);
}
int
po_gram_lex (union PO_GRAM_STYPE *lval, struct po_parser_state *ps)
{
- static char *buf;
- static size_t bufmax;
+ /* Cache ps->buf and ps->bufmax in local variables. */
+ char *buf = ps->buf;
+ size_t bufmax = ps->bufmax;
+
mbchar_t mbc;
size_t bufpos;
{
bufmax += 100;
buf = xrealloc (buf, bufmax);
+ ps->bufmax = bufmax;
+ ps->buf = buf;
}
if (mb_iseof (mbc) || mb_iseq (mbc, '\n'))
break;
{
bufmax += 100;
buf = xrealloc (buf, bufmax);
+ ps->bufmax = bufmax;
+ ps->buf = buf;
}
if (mb_iseof (mbc))
{
{
bufmax += 100;
buf = xrealloc (buf, bufmax);
+ ps->bufmax = bufmax;
+ ps->buf = buf;
}
buf[bufpos++] = c;
lex_getc (ps, mbc);
{
bufmax += 100;
buf = xrealloc (buf, bufmax + 1);
+ ps->bufmax = bufmax;
+ ps->buf = buf;
}
buf[bufpos++] = c;
lex_getc (ps, mbc);