summaryrefslogtreecommitdiff
path: root/libc/stdlib/malloc/alloc.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-01-12 09:42:21 +0000
committerEric Andersen <andersen@codepoet.org>2001-01-12 09:42:21 +0000
commit7415018e055da96e94fa61c43a5227555e8e6ba5 (patch)
treee2b54d753615e8865adbdfaea7ef7e2097c82435 /libc/stdlib/malloc/alloc.c
parent47459d25eba62743d0933aec5682c65525af7d7a (diff)
Manuel Novoa III modified malloc.c and avlmacro.h to reduce code size by
using functions instead on Inlining (size vas speed tradeoff). I ran the results through indent. Looking pretty good IMHO.
Diffstat (limited to 'libc/stdlib/malloc/alloc.c')
-rw-r--r--libc/stdlib/malloc/alloc.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/libc/stdlib/malloc/alloc.c b/libc/stdlib/malloc/alloc.c
index 22d508ca1..4988bb055 100644
--- a/libc/stdlib/malloc/alloc.c
+++ b/libc/stdlib/malloc/alloc.c
@@ -8,12 +8,14 @@
#ifdef L_calloc_dbg
-void *
-calloc_dbg(size_t num, size_t size, char * function, char * file, int line)
+void *calloc_dbg(size_t num, size_t size, char *function, char *file,
+ int line)
{
- void * ptr;
- fprintf(stderr, "calloc of %ld bytes at %s @%s:%d = ", (long)(num*size), function, file, line);
- ptr = calloc(num,size);
+ void *ptr;
+
+ fprintf(stderr, "calloc of %ld bytes at %s @%s:%d = ",
+ (long) (num * size), function, file, line);
+ ptr = calloc(num, size);
fprintf(stderr, "%p\n", ptr);
return ptr;
}
@@ -22,13 +24,14 @@ calloc_dbg(size_t num, size_t size, char * function, char * file, int line)
#ifdef L_malloc_dbg
-void *
-malloc_dbg(size_t len, char * function, char * file, int line)
+void *malloc_dbg(size_t len, char *function, char *file, int line)
{
- void * result;
- fprintf(stderr, "malloc of %ld bytes at %s @%s:%d = ", (long)len, function, file, line);
+ void *result;
+
+ fprintf(stderr, "malloc of %ld bytes at %s @%s:%d = ", (long) len,
+ function, file, line);
result = malloc(len);
- fprintf(stderr, "%p\n", result);
+ fprintf(stderr, "%p\n", result);
return result;
}
@@ -36,13 +39,11 @@ malloc_dbg(size_t len, char * function, char * file, int line)
#ifdef L_free_dbg
-void
-free_dbg(void * ptr, char * function, char * file, int line)
+void free_dbg(void *ptr, char *function, char *file, int line)
{
- fprintf(stderr, "free of %p at %s @%s:%d\n", ptr, function, file, line);
- free(ptr);
+ fprintf(stderr, "free of %p at %s @%s:%d\n", ptr, function, file,
+ line);
+ free(ptr);
}
#endif
-
-