summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2010-01-05 10:48:32 -0600
committerRob Landley <rob@landley.net>2010-01-05 10:48:32 -0600
commit1e01cd1f48bff3fdd12f45bf1c3adfab821ee287 (patch)
tree0643c843391c506b5fc31502a0610772e11b3670
parent69bc2c3ac1544ff51bd5d7979e02e2840241ec32 (diff)
downloadtoybox-1e01cd1f48bff3fdd12f45bf1c3adfab821ee287.tar.gz
toybox-1e01cd1f48bff3fdd12f45bf1c3adfab821ee287.tar.bz2
toybox-1e01cd1f48bff3fdd12f45bf1c3adfab821ee287.zip
Correct return types of xstrdup() and xstrndup()
-rw-r--r--lib/lib.c4
-rw-r--r--lib/lib.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/lib.c b/lib/lib.c
index e4b9d8e..48689d3 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -106,7 +106,7 @@ void *xrealloc(void *ptr, size_t size)
}
// Die unless we can allocate a copy of this many bytes of string.
-void *xstrndup(char *s, size_t n)
+char *xstrndup(char *s, size_t n)
{
char *ret = xmalloc(++n);
strncpy(ret, s, n);
@@ -116,7 +116,7 @@ void *xstrndup(char *s, size_t n)
}
// Die unless we can allocate a copy of this string.
-void *xstrdup(char *s)
+char *xstrdup(char *s)
{
return xstrndup(s, strlen(s));
}
diff --git a/lib/lib.h b/lib/lib.h
index 61e80cf..c6226aa 100644
--- a/lib/lib.h
+++ b/lib/lib.h
@@ -54,8 +54,8 @@ void perror_exit(char *msg, ...) noreturn;
void *xmalloc(size_t size);
void *xzalloc(size_t size);
void *xrealloc(void *ptr, size_t size);
-void *xstrndup(char *s, size_t n);
-void *xstrdup(char *s);
+char *xstrndup(char *s, size_t n);
+char *xstrdup(char *s);
char *xmsprintf(char *format, ...);
void xprintf(char *format, ...);
void xputs(char *s);