diff --git a/table.c b/table.c index 6bf5333..df7bffb 100644 --- a/table.c +++ b/table.c @@ -114,10 +114,14 @@ char *TableSetIdentifier(struct Table *Tbl, const char *Ident, int IdentLen) else { /* add it to the table - we economise by not allocating the whole structure here */ struct TableEntry *NewEntry = HeapAlloc(sizeof(struct TableEntry *) + IdentLen + 1); + printf("allocated 0x%lx:%d for '", (unsigned long)NewEntry, sizeof(struct TableEntry *) + IdentLen + 1); + fwrite(Ident, 1, IdentLen, stdout); + printf("'\n"); if (NewEntry == NULL) ProgramFail(NULL, "out of memory"); strncpy((char *)&NewEntry->p.Key[0], Ident, IdentLen); + NewEntry->p.Key[IdentLen] = '\0'; NewEntry->Next = Tbl->HashTable[AddAt]; Tbl->HashTable[AddAt] = NewEntry; return &NewEntry->p.Key[0];