split malloc_os and friends further into
• functions called by mksh’s grouping memory allocator • functions called by mksh code itself the latter may be changed to call the internal grouping allocator, if a porter so desires (but if this were recommended, the code in question would already do so, so…)
This commit is contained in:
10
lalloc.c
10
lalloc.c
@ -20,13 +20,13 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.15 2011/03/05 21:43:16 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/lalloc.c,v 1.16 2011/03/05 21:48:09 tg Exp $");
|
||||
|
||||
/* build with CPPFLAGS+= -DUSE_REALLOC_MALLOC=0 on ancient systems */
|
||||
#if defined(USE_REALLOC_MALLOC) && (USE_REALLOC_MALLOC == 0)
|
||||
#define remalloc(p,n) ((p) == NULL ? malloc_os(n) : realloc_os((p), (n)))
|
||||
#define remalloc(p,n) ((p) == NULL ? malloc_osi(n) : realloc_osi((p), (n)))
|
||||
#else
|
||||
#define remalloc(p,n) realloc_os((p), (n))
|
||||
#define remalloc(p,n) realloc_osi((p), (n))
|
||||
#endif
|
||||
|
||||
#define ALLOC_ISUNALIGNED(p) (((ptrdiff_t)(p)) % ALLOC_SIZE)
|
||||
@ -113,7 +113,7 @@ afree(void *ptr, Area *ap)
|
||||
/* unhook */
|
||||
pp->next = lp->next;
|
||||
/* now free ALLOC_ITEM */
|
||||
free_osmalloc(lp);
|
||||
free_osimalloc(lp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +127,6 @@ afreeall(Area *ap)
|
||||
/* make next ALLOC_ITEM head of list */
|
||||
ap->next = lp->next;
|
||||
/* free old head */
|
||||
free_osmalloc(lp);
|
||||
free_osimalloc(lp);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user