changeset 369:5715eed39575

Correct return types of xstrdup() and xstrndup()
author Rob Landley <rob@landley.net>
date Tue, 05 Jan 2010 10:48:32 -0600
parents f90c9600a1f4
children c7a26e26ad08
files lib/lib.c lib/lib.h
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lib/lib.c	Tue Jan 05 10:46:16 2010 -0600
+++ b/lib/lib.c	Tue Jan 05 10:48:32 2010 -0600
@@ -106,7 +106,7 @@
 }
 
 // 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 @@
 }
 
 // Die unless we can allocate a copy of this string.
-void *xstrdup(char *s)
+char *xstrdup(char *s)
 {
 	return xstrndup(s, strlen(s));
 }
--- a/lib/lib.h	Tue Jan 05 10:46:16 2010 -0600
+++ b/lib/lib.h	Tue Jan 05 10:48:32 2010 -0600
@@ -54,8 +54,8 @@
 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);