diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-11-11 11:29:40 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-11-11 22:44:13 +0300 |
commit | c515774a926572233c627526a273edd3d73077d5 (patch) | |
tree | 300404297974fbd6519cb6fb03b05b2b806ffb29 /preproc.c | |
parent | 29cb0bb1b39f4e3c9e013993457e85fce14f5142 (diff) | |
download | nasm-c515774a926572233c627526a273edd3d73077d5.tar.gz nasm-c515774a926572233c627526a273edd3d73077d5.tar.bz2 nasm-c515774a926572233c627526a273edd3d73077d5.zip |
preproc: Use nasm_zalloc for new_ExpDef, new_ExpInv
Srink the code and make it a bit faster.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'preproc.c')
-rw-r--r-- | preproc.c | 49 |
1 files changed, 10 insertions, 39 deletions
@@ -1387,29 +1387,11 @@ static inline Line *new_Line(void) */ static ExpDef *new_ExpDef(int exp_type) { - ExpDef *ed = (ExpDef*)nasm_malloc(sizeof(ExpDef)); - ed->prev = NULL; - ed->next = NULL; - ed->type = exp_type; - ed->name = NULL; - ed->nparam_min = 0; - ed->nparam_max = 0; - ed->casesense = true; - ed->plus = false; - ed->prepend = 0; - ed->label = NULL; - ed->line = NULL; - ed->last = NULL; - ed->linecount = 0; - ed->dlist = NULL; - ed->defaults = NULL; - ed->ndefs = 0; - ed->state = COND_NEVER; - ed->nolist = false; - ed->def_depth = 0; - ed->cur_depth = 0; - ed->max_depth = 0; - ed->ignoring = false; + ExpDef *ed = (ExpDef*)nasm_zalloc(sizeof(ExpDef)); + ed->type = exp_type; + ed->casesense = true; + ed->state = COND_NEVER; + return ed; } @@ -1419,22 +1401,11 @@ static ExpDef *new_ExpDef(int exp_type) */ static ExpInv *new_ExpInv(int exp_type, ExpDef *ed) { - ExpInv *ei = (ExpInv*)nasm_malloc(sizeof(ExpInv)); - ei->prev = NULL; - ei->type = exp_type; - ei->def = ed; - ei->name = NULL; - ei->label = NULL; - ei->label_text = NULL; - ei->current = NULL; - ei->params = NULL; - ei->iline = NULL; - ei->nparam = 0; - ei->rotate = 0; - ei->paramlen = NULL; - ei->unique = ++unique; - ei->emitting = false; - ei->lineno = 0; + ExpInv *ei = (ExpInv*)nasm_zalloc(sizeof(ExpInv)); + ei->type = exp_type; + ei->def = ed; + ei->unique = ++unique; + if ((istk->mmac_depth < 1) && (istk->expansion == NULL) && (ed != NULL) && |