summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-02-29 23:22:44 +0000
committerjbj <devnull@localhost>2000-02-29 23:22:44 +0000
commit8aceebd817c77792eea840ec5585264e023b13f4 (patch)
tree5fce6062037a9eb11b7545f1c1f224f87b200258 /rpmio
parent968b07939a883a54b17cc35702e93a0191bfb374 (diff)
downloadrpm-8aceebd817c77792eea840ec5585264e023b13f4.tar.gz
rpm-8aceebd817c77792eea840ec5585264e023b13f4.tar.bz2
rpm-8aceebd817c77792eea840ec5585264e023b13f4.zip
Portability fiddles.
Rebuild with latest rpmmodule.so code. CVS patchset: 3600 CVS date: 2000/02/29 23:22:44
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/rpmmalloc.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/rpmio/rpmmalloc.c b/rpmio/rpmmalloc.c
index 0e713d712..94167b650 100644
--- a/rpmio/rpmmalloc.c
+++ b/rpmio/rpmmalloc.c
@@ -2,7 +2,7 @@
void *vmefail(void)
{
- fprintf(stderr, _("virtual memory exhausted.\n"));
+ fprintf(stderr, _("memory alloc returned NULL.\n"));
exit(EXIT_FAILURE);
/*@notreached@*/
return NULL;
@@ -12,7 +12,9 @@ void *vmefail(void)
void * xmalloc (size_t size)
{
- register void *value = malloc (size);
+ register void *value;
+ if (size == 0) size++;
+ value = malloc (size);
if (value == 0)
value = vmefail();
return value;
@@ -20,7 +22,10 @@ void * xmalloc (size_t size)
void * xcalloc (size_t nmemb, size_t size)
{
- register void *value = calloc (nmemb, size);
+ register void *value;
+ if (size == 0) size++;
+ if (nmemb == 0) nmemb++;
+ value = calloc (nmemb, size);
if (value == 0)
value = vmefail();
return value;
@@ -28,7 +33,9 @@ void * xcalloc (size_t nmemb, size_t size)
void * xrealloc (void *ptr, size_t size)
{
- register void *value = realloc (ptr, size);
+ register void *value;
+ if (size == 0) size++;
+ value = realloc (ptr, size);
if (value == 0)
value = vmefail();
return value;