diff options
| author | Rob Landley <rob@landley.net> | 2006-05-19 20:36:49 +0000 |
|---|---|---|
| committer | Rob Landley <rob@landley.net> | 2006-05-19 20:36:49 +0000 |
| commit | 80b8ff07ca4c39114875c7fd3230c4e9ae823f83 (patch) | |
| tree | 0595f3f0671af4a40d5ee87c18bcf4dc4def3a41 /libbb | |
| parent | b1629b1b2abc17a6430e4173d64d7956784118e0 (diff) | |
| download | busybox-w32-80b8ff07ca4c39114875c7fd3230c4e9ae823f83.tar.gz busybox-w32-80b8ff07ca4c39114875c7fd3230c4e9ae823f83.tar.bz2 busybox-w32-80b8ff07ca4c39114875c7fd3230c4e9ae823f83.zip | |
A pending item in my tree I might as well check in: I plan to migrate calloc()
and bb_calloc() calls to bb_xzalloc() which allocates prezeroed memory but
only takes one argument (the size).
Diffstat (limited to 'libbb')
| -rw-r--r-- | libbb/xfuncs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index fa6aa0f9f..d3c9e41e1 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
| @@ -37,6 +37,15 @@ void *xrealloc(void *ptr, size_t size) | |||
| 37 | } | 37 | } |
| 38 | #endif | 38 | #endif |
| 39 | 39 | ||
| 40 | #ifdef L_xzalloc | ||
| 41 | void *xzalloc(size_t size) | ||
| 42 | { | ||
| 43 | void *ptr = xmalloc(size); | ||
| 44 | memset(ptr, 0, size); | ||
| 45 | return ptr; | ||
| 46 | } | ||
| 47 | #endif | ||
| 48 | |||
| 40 | #ifdef L_xcalloc | 49 | #ifdef L_xcalloc |
| 41 | void *xcalloc(size_t nmemb, size_t size) | 50 | void *xcalloc(size_t nmemb, size_t size) |
| 42 | { | 51 | { |
