# HG changeset patch # User Francisco J Ballesteros # Date 1328821243 0 # Node ID aa41ad9cdb997b527fde2d2ebd2e1ebc1f309108 # Parent f16d36fda368c705089fb869330d88aa0fa78bdd fix: cleanup malloc (and make it work; it would fail). R=nixiedev, john CC=nix-dev http://codereview.appspot.com/5653047 Committer: John Floren diff -r f16d36fda368 -r aa41ad9cdb99 sys/src/libc/port/malloc.c --- a/sys/src/libc/port/malloc.c Thu Feb 09 18:35:04 2012 +0000 +++ b/sys/src/libc/port/malloc.c Thu Feb 09 21:00:43 2012 +0000 @@ -46,7 +46,6 @@ oomexits = yn; } -#define TESTSEGBRK /* * we do minimal bookkeeping so we can tell pool * whether two blocks are adjacent and thus mergeable. @@ -57,20 +56,9 @@ ulong *x; n += 2*sizeof(ulong); /* two longs for us */ -#ifdef TESTSEGBRK -static char *top; - if(top == nil) - top = segbrk(0,0); - x = segbrk(top, top+n); - if(x == 0 || x == (void*)-1) - return nil; - x = (ulong*)top; - top += n; -#else x = sbrk(n); if(x == (void*)-1) return nil; -#endif x[0] = (n+7)&~7; /* sbrk rounds size up to mult. of 8 */ x[1] = 0xDeadBeef; return x+2;