cc: get rid of hunk pointer fiddling and just use alloc()
This commit is contained in:
parent
ecdf3f921e
commit
34cf2725d2
1 changed files with 6 additions and 27 deletions
|
@ -138,15 +138,8 @@ dodefine(char *cp)
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
s = lookup();
|
s = lookup();
|
||||||
l = strlen(p) + 2; /* +1 null, +1 nargs */
|
l = strlen(p) + 2; /* +1 null, +1 nargs */
|
||||||
while(l & 3)
|
s->macro = alloc(l);
|
||||||
l++;
|
memcpy(s->macro, p-1, l);
|
||||||
while(nhunk < l)
|
|
||||||
gethunk();
|
|
||||||
*hunk = 0;
|
|
||||||
strcpy(hunk+1, p);
|
|
||||||
s->macro = hunk;
|
|
||||||
hunk += l;
|
|
||||||
nhunk -= l;
|
|
||||||
} else {
|
} else {
|
||||||
s = lookup();
|
s = lookup();
|
||||||
s->macro = "\0001"; /* \000 is nargs */
|
s->macro = "\0001"; /* \000 is nargs */
|
||||||
|
@ -640,14 +633,8 @@ maclin(void)
|
||||||
|
|
||||||
nn:
|
nn:
|
||||||
c = strlen(symb) + 1;
|
c = strlen(symb) + 1;
|
||||||
while(c & 3)
|
cp = alloc(c);
|
||||||
c++;
|
memcpy(cp, symb, c);
|
||||||
while(nhunk < c)
|
|
||||||
gethunk();
|
|
||||||
cp = hunk;
|
|
||||||
memcpy(hunk, symb, c);
|
|
||||||
nhunk -= c;
|
|
||||||
hunk += c;
|
|
||||||
linehist(cp, n);
|
linehist(cp, n);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -774,17 +761,9 @@ praglib:
|
||||||
* put pragma-line in as a funny history
|
* put pragma-line in as a funny history
|
||||||
*/
|
*/
|
||||||
c = strlen(symb) + 1;
|
c = strlen(symb) + 1;
|
||||||
while(c & 3)
|
|
||||||
c++;
|
|
||||||
while(nhunk < c)
|
|
||||||
gethunk();
|
|
||||||
hp = hunk;
|
|
||||||
memcpy(hunk, symb, c);
|
|
||||||
nhunk -= c;
|
|
||||||
hunk += c;
|
|
||||||
|
|
||||||
h = alloc(sizeof(Hist));
|
h = alloc(sizeof(Hist));
|
||||||
h->name = hp;
|
h->name = alloc(c);
|
||||||
|
memcpy(h->name, symb, c);
|
||||||
h->line = lineno;
|
h->line = lineno;
|
||||||
h->offset = -1;
|
h->offset = -1;
|
||||||
h->link = H;
|
h->link = H;
|
||||||
|
|
Loading…
Reference in a new issue