summaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorEric Andersen2000-07-19 17:35:54 +0000
committerEric Andersen2000-07-19 17:35:54 +0000
commitae6eae02dd85a196a4545376a50166aede8ce7c1 (patch)
treec3dbc22408e4323f916fb1f1171f7aa73fa2aecc /utility.c
parent52d6fa3bb335fcfefc2b205e7ba509fc4b284793 (diff)
downloadbusybox-ae6eae02dd85a196a4545376a50166aede8ce7c1.zip
busybox-ae6eae02dd85a196a4545376a50166aede8ce7c1.tar.gz
Moved some code and add a coupld #defines to support use of dmalloc.
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r--utility.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/utility.c b/utility.c
index 18d3c14..50f497f 100644
--- a/utility.c
+++ b/utility.c
@@ -1454,17 +1454,28 @@ extern pid_t* findPidByName( char* pidName)
#endif /* BB_FEATURE_USE_DEVPS_PATCH */
#endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */
+#ifndef DMALLOC
/* this should really be farmed out to libbusybox.a */
extern void *xmalloc(size_t size)
{
- void *cp = malloc(size);
+ void *ptr = malloc(size);
- if (cp == NULL)
+ if (!ptr)
fatalError(memory_exhausted);
- return cp;
+ return ptr;
}
+void *xrealloc(void *old, size_t size)
+{
+ void *ptr = realloc(old, size);
+ if (!ptr)
+ fatalError(memory_exhausted);
+ return ptr;
+}
+#endif
+
#if defined BB_FEATURE_NFSMOUNT
+# ifndef DMALLOC
extern char * xstrdup (const char *s) {
char *t;
@@ -1478,6 +1489,7 @@ extern char * xstrdup (const char *s) {
return t;
}
+# endif
extern char * xstrndup (const char *s, int n) {
char *t;