[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] Re: [PATCH RESEND V8 5/7] libxl: Intruduce libxl__strndup.
On Wed, 2011-09-21 at 14:59 +0100, Christoph Egger wrote: > On 09/21/11 15:35, Ian Campbell wrote: > > On Wed, 2011-09-21 at 13:59 +0100, Anthony PERARD wrote: > >> Signed-off-by: Anthony PERARD<anthony.perard@xxxxxxxxxx> > > > > Acked-by: Ian Campbell<ian.campbell@xxxxxxxxxx> > > > >> --- > >> tools/libxl/libxl_internal.c | 10 ++++++++++ > >> tools/libxl/libxl_internal.h | 1 + > >> 2 files changed, 11 insertions(+), 0 deletions(-) > >> > >> diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c > >> index c4d54f9..0fb2315 100644 > >> --- a/tools/libxl/libxl_internal.c > >> +++ b/tools/libxl/libxl_internal.c > >> @@ -159,6 +159,16 @@ char *libxl__strdup(libxl__gc *gc, const char *c) > >> return s; > >> } > >> > >> +char *libxl__strndup(libxl__gc *gc, const char *c, size_t n) > >> +{ > >> + char *s = strndup(c, n); > >> + > >> + if (s) > >> + libxl__ptr_add(gc, s); > >> + > >> + return s; > >> +} > >> + > >> char *libxl__dirname(libxl__gc *gc, const char *s) > >> { > >> char *c; > >> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h > >> index 5d270bb..d873243 100644 > >> --- a/tools/libxl/libxl_internal.h > >> +++ b/tools/libxl/libxl_internal.h > >> @@ -148,6 +148,7 @@ _hidden void *libxl__calloc(libxl__gc *gc, size_t > >> nmemb, size_t size); > >> _hidden void *libxl__realloc(libxl__gc *gc, void *ptr, size_t new_size); > >> _hidden char *libxl__sprintf(libxl__gc *gc, const char *fmt, ...) > >> PRINTF_ATTRIBUTE(2, 3); > >> _hidden char *libxl__strdup(libxl__gc *gc, const char *c); > >> +_hidden char *libxl__strndup(libxl__gc *gc, const char *c, size_t n); > > Will libxl_strdup() go away ? Why should it? Both have their separate uses. > > Christoph > > >> _hidden char *libxl__dirname(libxl__gc *gc, const char *s); > >> > >> _hidden char **libxl__xs_kvs_of_flexarray(libxl__gc *gc, flexarray_t > >> *array, int length); > > > > > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@xxxxxxxxxxxxxxxxxxx > > http://lists.xensource.com/xen-devel > > > > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |