gesamt: unnoetige strdup calls entfernt
authorBernhard Urban <lewurm@gmail.com>
Mon, 14 Jun 2010 19:48:22 +0000 (21:48 +0200)
committerBernhard Urban <lewurm@gmail.com>
Mon, 14 Jun 2010 19:48:22 +0000 (21:48 +0200)
gesamt/parser.y
gesamt/symtable.c

index 67022564c33553b4bad34d5806b3681bece27754..107ede5c4992278fe35310d71b93909aeb1200a8 100644 (file)
@@ -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;
          @}
index 89db8c0e316fe04d3acdb0ad5fdab473f26cbdfc..2a9e96fead530afe68f6547512bb6428194616d4 100644 (file)
@@ -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;