9
0
Fork 0

add xstrdup function

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2009-09-25 12:16:30 +02:00
parent a205b87fa2
commit 0a0920af28
2 changed files with 11 additions and 0 deletions

View File

@ -4,5 +4,6 @@
void *xmalloc(size_t size);
void *xrealloc(void *ptr, size_t size);
void *xzalloc(size_t size);
char *xstrdup(const char *s);
#endif /* __XFUNCS_H */

View File

@ -60,3 +60,13 @@ void *xzalloc(size_t size)
}
EXPORT_SYMBOL(xzalloc);
char *xstrdup(const char *s)
{
char *p = strdup(s);
if (!p)
panic("ERROR: out of memory\n");
return p;
}
EXPORT_SYMBOL(xstrdup);