mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-17 09:02:25 +00:00
Fix a bug in macro call parameter parsing
This commit is contained in:
parent
d688820518
commit
7e660951c2
1 changed files with 10 additions and 1 deletions
11
ftepp.c
11
ftepp.c
|
@ -313,7 +313,7 @@ static bool ftepp_macro_call_params(ftepp_t *ftepp, macroparam **out_params)
|
|||
size_t parens = 0;
|
||||
size_t i;
|
||||
|
||||
while (true) {
|
||||
while (ftepp->token != ')') {
|
||||
mp.tokens = NULL;
|
||||
while (parens || ftepp->token != ',') {
|
||||
if (ftepp->token == '(')
|
||||
|
@ -386,6 +386,15 @@ static bool ftepp_macro_call(ftepp_t *ftepp, ppmacro *macro)
|
|||
if (!ftepp_macro_call_params(ftepp, ¶ms))
|
||||
return false;
|
||||
|
||||
if (vec_size(params) != vec_size(macro->params)) {
|
||||
ftepp_error(ftepp, "macro %s expects %u paramteters, %u provided", macro->name,
|
||||
(unsigned int)vec_size(macro->params),
|
||||
(unsigned int)vec_size(params));
|
||||
retval = false;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
||||
ftepp_out(ftepp, "Parsed macro parameters", false);
|
||||
goto cleanup;
|
||||
|
||||
|
|
Loading…
Reference in a new issue