- Check for NULL tree->delete callback
- Add xstrdup() function
This commit is contained in:
parent
da9a1e8084
commit
9e9e1925b9
3 changed files with 23 additions and 2 deletions
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if STDC_HEADERS
|
||||
# include <stdlib.h>
|
||||
|
@ -124,6 +125,18 @@ xrealloc (p, n)
|
|||
return p;
|
||||
}
|
||||
|
||||
/* Duplicate a string */
|
||||
|
||||
char *xstrdup(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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue