From c515774a926572233c627526a273edd3d73077d5 Mon Sep 17 00:00:00 2001 From: Cyrill Gorcunov Date: Thu, 11 Nov 2010 11:29:40 +0300 Subject: [PATCH] preproc: Use nasm_zalloc for new_ExpDef, new_ExpInv Srink the code and make it a bit faster. Signed-off-by: Cyrill Gorcunov --- preproc.c | 49 ++++++++++--------------------------------------- 1 file changed, 10 insertions(+), 39 deletions(-) diff --git a/preproc.c b/preproc.c index 03686f4..df59cf0 100644 --- a/preproc.c +++ b/preproc.c @@ -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) && -- 2.7.4