* Copyright (c) 1989 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)symtab.c 5.3 (Berkeley) %G%";
/* TABLE_SIZE is the number of entries in the symbol table. */
/* TABLE_SIZE must be a power of two. */
k
= (31*k
+ c
) & (TABLE_SIZE
- 1);
bp
= (bucket
*) MALLOC(sizeof(bucket
));
bp
->name
= MALLOC(strlen(name
) + 1);
if (bp
->name
== 0) no_space();
if (bp
->name
== 0) no_space();
register bucket
*bp
, **bpp
;
bpp
= symbol_table
+ hash(name
);
if (strcmp(name
, bp
->name
) == 0) return (bp
);
*bpp
= bp
= make_bucket(name
);
symbol_table
= (bucket
**) MALLOC(TABLE_SIZE
*sizeof(bucket
*));
if (symbol_table
== 0) no_space();
for (i
= 0; i
< TABLE_SIZE
; i
++)
bp
= make_bucket("error");
symbol_table
[hash("error")] = bp
;
for (p
= first_symbol
; p
; p
= q
)