From: Bernhard Urban Date: Mon, 14 Jun 2010 19:48:22 +0000 (+0200) Subject: gesamt: unnoetige strdup calls entfernt X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=uebersetzerbau-ss10.git;a=commitdiff_plain;h=3cc9774c47638019932f476371f731bc61a7f1eb gesamt: unnoetige strdup calls entfernt --- diff --git a/gesamt/parser.y b/gesamt/parser.y index 6702256..107ede5 100644 --- a/gesamt/parser.y +++ b/gesamt/parser.y @@ -331,7 +331,7 @@ IdentCommon: @IdentCommon.node@ = TREENULL; if(tab_lookup(@IdentCommon.s@, @IDENT.name@, S_VAR|S_PARM) == SYMNULL) { /* es handelt sich um ein feldzugriff auf this */ - @IdentCommon.node@ = new_field(@IDENT.name@, new_param(O_ID, strdup("this"), TREENULL, TREENULL, 0), TREENULL, tab_lookup(@IdentCommon.s@, @IDENT.name@, S_FIELD) == SYMNULL ? -1 : tab_lookup(@IdentCommon.s@, @IDENT.name@, S_FIELD)->soffset); + @IdentCommon.node@ = new_field(@IDENT.name@, new_param(O_ID, "this", TREENULL, TREENULL, 0), TREENULL, tab_lookup(@IdentCommon.s@, @IDENT.name@, S_FIELD) == SYMNULL ? -1 : tab_lookup(@IdentCommon.s@, @IDENT.name@, S_FIELD)->soffset); } else { /* param oder var */ int tmp = tab_lookup(@IdentCommon.s@, @IDENT.name@, S_VAR|S_PARM) == SYMNULL ? -1 : tab_lookup(@IdentCommon.s@, @IDENT.name@, S_VAR|S_PARM)->param_index; @IdentCommon.node@ = new_param(O_ID, @IDENT.name@, TREENULL, TREENULL, tmp); @@ -530,7 +530,7 @@ Term: | THIS @{ - @i @Term.node@ = new_param(O_ID, strdup("this"), TREENULL, TREENULL, 0); + @i @Term.node@ = new_param(O_ID, "this", TREENULL, TREENULL, 0); @i @Term.imm@ = 0; @i @Term.call@ = 0; @} diff --git a/gesamt/symtable.c b/gesamt/symtable.c index 89db8c0..2a9e96f 100644 --- a/gesamt/symtable.c +++ b/gesamt/symtable.c @@ -54,7 +54,7 @@ struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short new_elm = (struct symbol *) malloc(sizeof(struct symbol)); new_elm->next = SYMNULL; - new_elm->ident = strdup(ident); + new_elm->ident = ident; new_elm->type = type; new_elm->param_index = param_index; new_elm->soffset = soffset;