version 1.5, 1997/07/14 00:24:30 |
version 1.6, 1997/11/14 00:23:58 |
|
|
salloc(size) |
salloc(size) |
int size; |
int size; |
{ |
{ |
register char *t; |
char *t; |
register int s; |
int s; |
register struct strings *sp; |
struct strings *sp; |
int index; |
int index; |
|
|
s = size; |
s = size; |
|
|
index++; |
index++; |
} |
} |
if (sp >= &stringdope[NSPACE]) |
if (sp >= &stringdope[NSPACE]) |
panic("String too large"); |
errx(1, "String too large"); |
if (sp->s_topFree == NULL) { |
if (sp->s_topFree == NULL) { |
index = sp - &stringdope[0]; |
index = sp - &stringdope[0]; |
sp->s_topFree = (char *)malloc(STRINGSIZE << index); |
sp->s_topFree = (char *)malloc(STRINGSIZE << index); |
if (sp->s_topFree == NULL) { |
if (sp->s_topFree == NULL) |
fprintf(stderr, "No room for space %d\n", index); |
errx(1, "No room for space %d", index); |
panic("Internal error"); |
|
} |
|
sp->s_nextFree = sp->s_topFree; |
sp->s_nextFree = sp->s_topFree; |
sp->s_nleft = STRINGSIZE << index; |
sp->s_nleft = STRINGSIZE << index; |
} |
} |
|
|
void |
void |
sreset() |
sreset() |
{ |
{ |
register struct strings *sp; |
struct strings *sp; |
register int index; |
int index; |
|
|
if (noreset) |
if (noreset) |
return; |
return; |
|
|
void |
void |
spreserve() |
spreserve() |
{ |
{ |
register struct strings *sp; |
struct strings *sp; |
|
|
for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) |
for (sp = &stringdope[0]; sp < &stringdope[NSPACE]; sp++) |
sp->s_topFree = NULL; |
sp->s_topFree = NULL; |