[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 for-4.5 3/5] xl: add 'xstrdup' next to 'xrealloc'



On Wed, Sep 24, 2014 at 09:48:03PM +0100, David Scott wrote:
> Signed-off-by: David Scott <dave.scott@xxxxxxxxxx>

Acked-by: Wei Liu <wei.liu2@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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.