diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
commit | 1b8a56941708e6fe884f4649f718fae7c543c045 (patch) | |
tree | 3d7be0a7e43b01aba6dd986bff06bcc3947a6d78 /sys/src/cmd/kl/obj.c | |
parent | 9d46360c9d83fa95f42f1eebbad49ecd9281fb0d (diff) |
cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.
to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.
Diffstat (limited to 'sys/src/cmd/kl/obj.c')
-rw-r--r-- | sys/src/cmd/kl/obj.c | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/sys/src/cmd/kl/obj.c b/sys/src/cmd/kl/obj.c index b778cfd8d..dd324dfb3 100644 --- a/sys/src/cmd/kl/obj.c +++ b/sys/src/cmd/kl/obj.c @@ -194,7 +194,7 @@ main(int argc, char *argv[]) out: if(debug['v']) { Bprint(&bso, "%5.2f cpu time\n", cputime()); - Bprint(&bso, "%zud memory used\n", tothunk); + Bprint(&bso, "%zud memory used\n", thunk); Bprint(&bso, "%d sizeof adr\n", sizeof(Adr)); Bprint(&bso, "%d sizeof prog\n", sizeof(Prog)); } @@ -977,29 +977,6 @@ prg(void) } void -gethunk(void) -{ - char *h; - long nh; - - nh = NHUNK; - if(tothunk >= 5L*NHUNK) { - nh = 5L*NHUNK; - if(tothunk >= 25L*NHUNK) - nh = 25L*NHUNK; - } - h = mysbrk(nh); - if(h == (char *)-1) { - diag("out of memory"); - errorexit(); - } - - hunk = h; - nhunk = nh; - tothunk += nh; -} - -void doprof1(void) { Sym *s; |