projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
14869f8
)
lexer: Make lex_error_expecting_valist() support a longer list.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sun, 18 Sep 2022 23:42:26 +0000
(16:42 -0700)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sun, 18 Sep 2022 23:42:26 +0000
(16:42 -0700)
src/language/lexer/lexer.c
patch
|
blob
|
history
diff --git
a/src/language/lexer/lexer.c
b/src/language/lexer/lexer.c
index f9236af19fc394cb55d63f90ded975f2218f10d1..a2a0da9713c8f044398af94c0cb5c94580a095a7 100644
(file)
--- a/
src/language/lexer/lexer.c
+++ b/
src/language/lexer/lexer.c
@@
-519,18
+519,22
@@
void
void
lex_error_expecting_valist (struct lexer *lexer, va_list args)
{
void
lex_error_expecting_valist (struct lexer *lexer, va_list args)
{
- enum { MAX_OPTIONS = 9 };
- const char *options[MAX_OPTIONS];
- int n = 0;
- while (n < MAX_OPTIONS)
+ const char **options = NULL;
+ size_t allocated = 0;
+ size_t n = 0;
+
+ for (;;)
{
const char *option = va_arg (args, const char *);
if (!option)
break;
{
const char *option = va_arg (args, const char *);
if (!option)
break;
+ if (n >= allocated)
+ options = x2nrealloc (options, &allocated, sizeof *options);
options[n++] = option;
}
lex_error_expecting_array (lexer, options, n);
options[n++] = option;
}
lex_error_expecting_array (lexer, options, n);
+ free (options);
}
void
}
void