From mboxrd@z Thu Jan 1 00:00:00 1970 From: Konrad Rzeszutek Wilk Subject: Re: [PATCH v6 for-4.5 3/5] xl: add 'xstrdup' next to 'xrealloc' Date: Thu, 25 Sep 2014 15:06:28 -0400 Message-ID: <20140925190628.GC29663@laptop.dumpdata.com> References: <1411591685-25308-1-git-send-email-dave.scott@citrix.com> <1411591685-25308-4-git-send-email-dave.scott@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XXENC-00035z-7a for xen-devel@lists.xenproject.org; Thu, 25 Sep 2014 19:06:38 +0000 Content-Disposition: inline In-Reply-To: <1411591685-25308-4-git-send-email-dave.scott@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Scott Cc: xen-devel@lists.xenproject.org, stefano.stabellini@eu.citrix.com, ian.jackson@eu.citrix.com, wei.liu2@citrix.com, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org On Wed, Sep 24, 2014 at 09:48:03PM +0100, David Scott wrote: > Signed-off-by: David Scott Reviewed-by: Konrad Rzeszutek Wilk > --- > 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@lists.xen.org > http://lists.xen.org/xen-devel