[sheepdog] [PATCH 1/2] lib: add a new wrapper function of strdup()

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Thu Aug 21 03:14:52 CEST 2014


At Wed, 20 Aug 2014 20:28:10 +0800,
Ruoyu wrote:
> 
> Reviewed-by: Ruoyu <liangry at ucweb.com>

Thanks for your review, Ruoyu. Applied this series.

Thanks,
Hitoshi

> 
> 
> On 2014年08月20日 17:07, Hitoshi Mitake wrote:
> > Cc: Ruoyu <liangry at ucweb.com>
> > Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
> > ---
> >   include/util.h |  2 ++
> >   lib/util.c     | 12 ++++++++++++
> >   2 files changed, 14 insertions(+)
> >
> > diff --git a/include/util.h b/include/util.h
> > index 9da872d..69e114b 100644
> > --- a/include/util.h
> > +++ b/include/util.h
> > @@ -573,4 +573,6 @@ static inline uint64_t clock_get_time(void)
> >   	return (uint64_t)ts.tv_sec * 1000000000LL + (uint64_t)ts.tv_nsec;
> >   }
> >   
> > +char *xstrdup(const char *s);
> > +
> >   #endif
> > diff --git a/lib/util.c b/lib/util.c
> > index a5b7532..164f755 100644
> > --- a/lib/util.c
> > +++ b/lib/util.c
> > @@ -831,3 +831,15 @@ double get_time_interval(const struct timespec *start,
> >   	return ((end->tv_nsec - start->tv_nsec) * 0.000000001)
> >   			+ end->tv_sec - start->tv_sec;
> >   }
> > +
> > +char *xstrdup(const char *s)
> > +{
> > +	char *ret;
> > +
> > +	ret = strdup(s);
> > +	if (!ret)
> > +		panic("Out of memory");
> > +
> > +	return ret;
> > +}
> > +
> 
> 



More information about the sheepdog mailing list