diff options
author | jbj <devnull@localhost> | 1999-09-22 16:34:08 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 1999-09-22 16:34:08 +0000 |
commit | 444952d085ab84f3960fc6ed3f402499dd69527c (patch) | |
tree | 56339d8875e00f075df533a6e019164b38956239 /rpmio | |
parent | 868920d4a76844d8cbef8589e7247f4c9ff1a104 (diff) | |
download | librpm-tizen-444952d085ab84f3960fc6ed3f402499dd69527c.tar.gz librpm-tizen-444952d085ab84f3960fc6ed3f402499dd69527c.tar.bz2 librpm-tizen-444952d085ab84f3960fc6ed3f402499dd69527c.zip |
Orphan.
CVS patchset: 3316
CVS date: 1999/09/22 16:34:08
Diffstat (limited to 'rpmio')
-rw-r--r-- | rpmio/rpmmalloc.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/rpmio/rpmmalloc.c b/rpmio/rpmmalloc.c new file mode 100644 index 000000000..7ba9d67b0 --- /dev/null +++ b/rpmio/rpmmalloc.c @@ -0,0 +1,44 @@ +#include "system.h" + +void *vmefail(void) +{ + err(EXIT_FAILURE, "virtual memory exhausted"); + return NULL; +} + +#if !(HAVE_MCHECK_H && defined(__GNUC__)) + +void * xmalloc (size_t size) +{ + register void *value = malloc (size); + if (value == 0) + value = vmefail(); + return value; +} + +void * xcalloc (size_t nmemb, size_t size) +{ + register void *value = calloc (nmemb, size); + if (value == 0) + value = vmefail(); + return value; +} + +void * xrealloc (void *ptr, size_t size) +{ + register void *value = realloc (ptr, size); + if (value == 0) + value = vmefail(); + return value; +} + +char * xstrdup (const char *str) +{ + char *newstr = (char *) malloc (strlen(str) + 1); + if (newstr == 0) + newstr = (char *) vmefail(); + strcpy (newstr, str); + return newstr; +} + +#endif /* !(HAVE_MCHECK_H && defined(__GNUC__)) */ |