3 source/interpret.c | 37 ++++++++++++++++++++++++-------------
4 source/interpret.h | 4 ++--
5 2 files changed, 26 insertions(+), 15 deletions(-)
7 diff --quilt old/source/interpret.c new/source/interpret.c
8 --- old/source/interpret.c
9 +++ new/source/interpret.c
10 @@ -862,8 +862,8 @@ Symbol *InstallSymbol(const char *name,
14 - s = (Symbol *)malloc(sizeof(Symbol));
15 - s->name = (char *)malloc(strlen(name)+1); /* +1 for '\0' */
16 + /* no +1, because of .name[1] */
17 + s = malloc(sizeof(Symbol) + strlen(name));
18 strcpy(s->name, name);
21 @@ -1254,11 +1254,10 @@ static void freeSymbolTable(Symbol *symT
24 while(symTab != NULL) {
36 #define POP(dataVal) \
37 @@ -2751,14 +2750,26 @@ int OverlayRoutineFromSymbol(Symbol *sym
39 int OverlayRoutineFromProg(Program *prog, int nArgs, int removeArgs)
45 + /* no +1, because of .name[1] */
46 + sym = malloc(sizeof(Symbol) + strlen(prog->name));
51 + sym->type = MACRO_FUNCTION_SYM;
52 + strcpy(sym->name, prog->name);
53 + sym->value.val.prog = prog;
57 + ret = OverlayRoutineFromSymbol(sym, nArgs, removeArgs);
59 - sym.type = MACRO_FUNCTION_SYM;
60 - sym.name = prog->name;
61 - sym.value.val.str.rep = (char *)prog;
65 - return OverlayRoutineFromSymbol(&sym, nArgs, removeArgs);
70 diff --quilt old/source/interpret.h new/source/interpret.h
71 --- old/source/interpret.h
72 +++ new/source/interpret.h
73 @@ -108,11 +108,11 @@ typedef struct SparseArrayEntryTag {
75 /* symbol table entry */
76 typedef struct SymbolRec {
80 - struct SymbolRec *next; /* to link to another */
82 + struct SymbolRec *next; /* to link to another */
86 typedef struct ProgramTag {