diff options
author | Robert de Bath <rdebath@poboxes.com> | 1996-03-24 17:45:55 +0100 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:29:43 +0200 |
commit | fe22c37817ce338fbbc90b239320248c270957fa (patch) | |
tree | d9550410c4a20bdd382fcc58d2d3d7c5e04e5245 /ld/table.c | |
parent | a7aba15e8efffb1c5d3097656f1a93955a64f01f (diff) | |
parent | 42192453ea219b80d0bf9f41e51e36d3d4d0740b (diff) | |
download | dev86-fe22c37817ce338fbbc90b239320248c270957fa.tar.gz |
Import Dev86-0.0.4.tar.gzv0.0.4
Diffstat (limited to 'ld/table.c')
-rw-r--r-- | ld/table.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -10,9 +10,10 @@ #ifdef STDC_HEADERS_MISSING void *malloc P((unsigned size)); +char * strcpy P((char* dest, char* src)); #else -#undef NULL #include <stdlib.h> +#include <string.h> #endif #define GOLDEN 157 /* GOLDEN/HASHTABSIZE approx golden ratio */ @@ -32,13 +33,13 @@ PUBLIC void syminit() for (i = sizeof(int) <= 2 ? 0xE000 : (unsigned) 0x38000; i != 0; i -= 512) - if ((tableptr = malloc(i)) != NULL) + if ((tableptr = malloc(i)) != NUL_PTR) break; - if (tableptr == NULL) + if (tableptr == NUL_PTR) outofmemory(); tableend = tableptr + i; for (i = 0; i < HASHTABSIZE; i++) - hashtab[i] = NULL; + hashtab[i] = NUL_PTR; } /* add named symbol to end of table - initialise only name and next fields */ @@ -48,12 +49,12 @@ PUBLIC struct symstruct *addsym(name) char *name; { struct symstruct **hashptr; - struct symstruct *oldsymptr; + struct symstruct *oldsymptr = 0; struct symstruct *symptr; hashptr = gethashptr(name); symptr = *hashptr; - while (symptr != NULL) + while (symptr != NUL_PTR) { oldsymptr = symptr; symptr = symptr->next; @@ -62,11 +63,11 @@ char *name; symptr = (struct symstruct *) tableptr; if ((tableptr = symptr->name + (strlen(name) + 1)) > tableend) outofmemory(); - symptr->modptr = NULL; - symptr->next = NULL; + symptr->modptr = NUL_PTR; + symptr->next = NUL_PTR; if (name != symptr->name) strcpy(symptr->name, name); /* should't happen */ - if (*hashptr == NULL) + if (*hashptr == NUL_PTR) *hashptr = symptr; else oldsymptr->next = symptr; @@ -81,7 +82,7 @@ char *name; struct symstruct *symptr; symptr = *gethashptr(name); - while (symptr != NULL && (!(symptr->flags & (E_MASK | I_MASK)) || + while (symptr != NUL_PTR && (!(symptr->flags & (E_MASK | I_MASK)) || strcmp(symptr->name, name) != 0)) symptr = symptr->next; return symptr; |