|
|
1.1 root 1: static char *sccsid = "@(#)string.c 1.2 (Berkeley) 3/7/81";
2: /* Copyright (c) 1979 Regents of the University of California */
3: #
4: /*
5: * pxp - Pascal execution profiler
6: *
7: * Bill Joy UCB
8: * Version 1.2 January 1979
9: */
10:
11: #include "0.h"
12:
13: /*
14: * STRING SPACE DECLARATIONS
15: *
16: * Strng is the base of the current
17: * string space and strngp the
18: * base of the free area therein.
19: * No array of descriptors is needed
20: * as string space is never freed.
21: */
22: STATIC char strings[STRINC];
23: STATIC char *strng = strings;
24: STATIC char *strngp = strings;
25:
26: /*
27: initstring()
28: {
29:
30: }
31: */
32: /*
33: * Copy a string into the string area.
34: */
35: savestr(cp)
36: register char *cp;
37: {
38: register int i;
39:
40: i = strlen(cp) + 1;
41: if (strngp + i >= strng + STRINC) {
42: strngp = alloc(STRINC);
43: if (strngp == -1) {
44: yerror("Ran out of memory (string)");
45: pexit(DIED);
46: }
47: strng = strngp;
48: }
49: strcpy(strngp, cp);
50: cp = strngp;
51: strngp = cp + i;
52: return (cp);
53: }
54:
55: esavestr(cp)
56: char *cp;
57: {
58:
59: strngp = (int)(strngp + (sizeof (int) - 1)) &~ (sizeof (int) - 1);
60: return (savestr(cp));
61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.