summaryrefslogtreecommitdiff
path: root/common.c
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2018-03-17 12:39:00 +0100
committerMartin Mares <mj@ucw.cz>2018-03-17 12:39:00 +0100
commitd1d7d88a5d0009a9a01f623f887bef2bdc3728d3 (patch)
tree0e9563f41ae26481cc5fc2b5a29eea434084cbac /common.c
parentb47b5bd408e161901fcee67346f5ea8d26087c12 (diff)
downloadpciutils-d1d7d88a5d0009a9a01f623f887bef2bdc3728d3.tar.gz
Adjust prototypes of xmalloc(), xrealloc() and xstrdup()
SylixOS defines its own versions of these functions in its standard library, which collide with ours. However, their prototypes make more sense, because they follow the prototypes of the non-x versions in the C standard, so there is no harm in following them.
Diffstat (limited to 'common.c')
-rw-r--r--common.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/common.c b/common.c
index 8ea52fa..9cd72be 100644
--- a/common.c
+++ b/common.c
@@ -1,7 +1,7 @@
/*
* The PCI Utilities -- Common Functions
*
- * Copyright (c) 1997--2008 Martin Mares <mj@ucw.cz>
+ * Copyright (c) 1997--2016 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
@@ -27,25 +27,25 @@ die(char *msg, ...)
}
void *
-xmalloc(unsigned int howmuch)
+xmalloc(size_t howmuch)
{
void *p = malloc(howmuch);
if (!p)
- die("Unable to allocate %d bytes of memory", howmuch);
+ die("Unable to allocate %d bytes of memory", (int) howmuch);
return p;
}
void *
-xrealloc(void *ptr, unsigned int howmuch)
+xrealloc(void *ptr, size_t howmuch)
{
void *p = realloc(ptr, howmuch);
if (!p)
- die("Unable to allocate %d bytes of memory", howmuch);
+ die("Unable to allocate %d bytes of memory", (int) howmuch);
return p;
}
char *
-xstrdup(char *str)
+xstrdup(const char *str)
{
int len = strlen(str) + 1;
char *copy = xmalloc(len);