forked from mirrors/tftp-hpa-google
Add replacement library files
This commit is contained in:
parent
e6593dd693
commit
d0fec7a322
4 changed files with 87 additions and 0 deletions
22
lib/xstrdup.c
Normal file
22
lib/xstrdup.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* xstrdup.c
|
||||
*
|
||||
* Simple error-checking version of strdup()
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char *xstrdup(const char *s)
|
||||
{
|
||||
char *p = strdup(s);
|
||||
|
||||
if ( !p ) {
|
||||
fprintf(stderr, "Out of memory!\n");
|
||||
exit(128);
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue