[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v6 for-4.5 3/5] xl: add 'xstrdup' next to 'xrealloc'
Signed-off-by: David Scott <dave.scott@xxxxxxxxxx> --- tools/libxl/xl_cmdimpl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 1695f74..1fc2171 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -300,6 +300,19 @@ static void *xrealloc(void *ptr, size_t sz) { return r; } +static char *xstrdup(const char *x) __attribute__ ((unused)); +static char *xstrdup(const char *x) +{ + char *r; + r = strdup(x); + if (!r) { + fprintf(stderr, "xl: Unable to strdup a string of length %zu.\n", + strlen(x)); + exit(-ERROR_FAIL); + } + return r; +} + #define ARRAY_EXTEND_INIT(array,count,initfn) \ ({ \ typeof((count)) array_extend_old_count = (count); \ -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |