diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-07-19 17:35:54 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-07-19 17:35:54 +0000 |
commit | ae6eae02dd85a196a4545376a50166aede8ce7c1 (patch) | |
tree | c3dbc22408e4323f916fb1f1171f7aa73fa2aecc /utility.c | |
parent | 52d6fa3bb335fcfefc2b205e7ba509fc4b284793 (diff) | |
download | busybox-w32-ae6eae02dd85a196a4545376a50166aede8ce7c1.tar.gz busybox-w32-ae6eae02dd85a196a4545376a50166aede8ce7c1.tar.bz2 busybox-w32-ae6eae02dd85a196a4545376a50166aede8ce7c1.zip |
Moved some code and add a coupld #defines to support use of dmalloc.
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1454,17 +1454,28 @@ extern pid_t* findPidByName( char* pidName) | |||
1454 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ | 1454 | #endif /* BB_FEATURE_USE_DEVPS_PATCH */ |
1455 | #endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */ | 1455 | #endif /* BB_KILLALL || ( BB_FEATURE_LINUXRC && ( BB_HALT || BB_REBOOT || BB_POWEROFF )) */ |
1456 | 1456 | ||
1457 | #ifndef DMALLOC | ||
1457 | /* this should really be farmed out to libbusybox.a */ | 1458 | /* this should really be farmed out to libbusybox.a */ |
1458 | extern void *xmalloc(size_t size) | 1459 | extern void *xmalloc(size_t size) |
1459 | { | 1460 | { |
1460 | void *cp = malloc(size); | 1461 | void *ptr = malloc(size); |
1461 | 1462 | ||
1462 | if (cp == NULL) | 1463 | if (!ptr) |
1463 | fatalError(memory_exhausted); | 1464 | fatalError(memory_exhausted); |
1464 | return cp; | 1465 | return ptr; |
1465 | } | 1466 | } |
1466 | 1467 | ||
1468 | void *xrealloc(void *old, size_t size) | ||
1469 | { | ||
1470 | void *ptr = realloc(old, size); | ||
1471 | if (!ptr) | ||
1472 | fatalError(memory_exhausted); | ||
1473 | return ptr; | ||
1474 | } | ||
1475 | #endif | ||
1476 | |||
1467 | #if defined BB_FEATURE_NFSMOUNT | 1477 | #if defined BB_FEATURE_NFSMOUNT |
1478 | # ifndef DMALLOC | ||
1468 | extern char * xstrdup (const char *s) { | 1479 | extern char * xstrdup (const char *s) { |
1469 | char *t; | 1480 | char *t; |
1470 | 1481 | ||
@@ -1478,6 +1489,7 @@ extern char * xstrdup (const char *s) { | |||
1478 | 1489 | ||
1479 | return t; | 1490 | return t; |
1480 | } | 1491 | } |
1492 | # endif | ||
1481 | 1493 | ||
1482 | extern char * xstrndup (const char *s, int n) { | 1494 | extern char * xstrndup (const char *s, int n) { |
1483 | char *t; | 1495 | char *t; |