projects
/
tinc
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- Cleaned up subnet_t
[tinc]
/
lib
/
xmalloc.c
diff --git
a/lib/xmalloc.c
b/lib/xmalloc.c
index
037fab8
..
e1ab314
100644
(file)
--- a/
lib/xmalloc.c
+++ b/
lib/xmalloc.c
@@
-21,6
+21,7
@@
#include <sys/types.h>
#include <stdio.h>
#include <sys/types.h>
#include <stdio.h>
+#include <string.h>
#if STDC_HEADERS
# include <stdlib.h>
#if STDC_HEADERS
# include <stdlib.h>
@@
-124,6
+125,18
@@
xrealloc (p, n)
return p;
}
return p;
}
+/* Duplicate a string */
+
+char *xstrdup(const char *s)
+{
+ char *p;
+
+ p = strdup(s);
+ if(!p)
+ xalloc_fail ((int)strlen(s));
+ return p;
+}
+
#ifdef NOT_USED
/* Allocate memory for N elements of S bytes, with error checking. */
#ifdef NOT_USED
/* Allocate memory for N elements of S bytes, with error checking. */