1 |
< |
/* |
1 |
> |
/* Copyright 1988 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
5 |
|
#endif |
6 |
+ |
|
7 |
+ |
/* |
8 |
|
* savestr.c - routines for efficient string storage. |
9 |
|
* |
10 |
|
* Savestr(s) stores a shared read-only string. |
33 |
|
|
34 |
|
static S_HEAD *stab[NHASH]; |
35 |
|
|
36 |
+ |
static int shash(); |
37 |
+ |
|
38 |
|
extern char *savestr(), *strcpy(), *malloc(); |
39 |
|
|
40 |
|
#define NULL 0 |
93 |
|
sfree(sp); |
94 |
|
return; |
95 |
|
} |
92 |
– |
} |
93 |
– |
|
94 |
– |
|
95 |
– |
int |
96 |
– |
strcmp(s1, s2) /* check for s1==s2 */ |
97 |
– |
register char *s1, *s2; |
98 |
– |
{ |
99 |
– |
if (s1 == s2) |
100 |
– |
return(0); |
101 |
– |
|
102 |
– |
while (*s1 == *s2++) |
103 |
– |
if (!*s1++) |
104 |
– |
return(0); |
105 |
– |
|
106 |
– |
return(*s1 - *--s2); |
96 |
|
} |
97 |
|
|
98 |
|
|