1 |
– |
/* Copyright 1988 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* savestr.c - routines for efficient string storage. |
6 |
|
* |
9 |
|
* All strings must be null-terminated. There is |
10 |
|
* no imposed length limit. |
11 |
|
* Strings stored with savestr(s) can be equated |
12 |
< |
* reliably using their pointer values. A tailored version |
16 |
< |
* of strcmp(s1,s2) is included. |
12 |
> |
* reliably using their pointer values. |
13 |
|
* Calls to savestr(s) and freestr(s) should be |
14 |
|
* balanced (obviously). The last call to freestr(s) |
15 |
|
* frees memory associated with the string; it should |
16 |
|
* never be referenced again. |
17 |
|
* |
18 |
< |
* 5/14/87 |
18 |
> |
* External symbols declared in standard.h |
19 |
|
*/ |
20 |
|
|
21 |
+ |
#include "copyright.h" |
22 |
+ |
|
23 |
|
#ifndef NHASH |
24 |
|
#define NHASH 509 /* hash table size (prime!) */ |
25 |
|
#endif |
41 |
|
|
42 |
|
#define salloc(str) (S_HEAD *)malloc(sizeof(S_HEAD)+1+strlen(str)) |
43 |
|
|
44 |
< |
#define sfree(sp) free((char *)(sp)) |
44 |
> |
#define sfree(sp) free((void *)(sp)) |
45 |
|
|
46 |
|
|
47 |
|
char * |
71 |
|
} |
72 |
|
|
73 |
|
|
74 |
+ |
void |
75 |
|
freestr(s) /* free a string */ |
76 |
|
char *s; |
77 |
|
{ |