[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: simplify libxl__dirname()
commit 83e26b9c41f6d2d18f54eb855490fce519aead57 Author: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> AuthorDate: Tue Mar 11 22:15:22 2014 +0800 Commit: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CommitDate: Thu Mar 13 16:51:13 2014 +0000 libxl: simplify libxl__dirname() Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl_internal.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c index 16b82b9..1db48b6 100644 --- a/tools/libxl/libxl_internal.c +++ b/tools/libxl/libxl_internal.c @@ -162,14 +162,12 @@ char *libxl__strndup(libxl__gc *gc, const char *c, size_t n) char *libxl__dirname(libxl__gc *gc, const char *s) { - char *c; - char *ptr = libxl__strdup(gc, s); + char *c = strrchr(s, '/'); - c = strrchr(ptr, '/'); if (!c) return NULL; - *c = '\0'; - return ptr; + + return libxl__strndup(gc, s, c - s); } void libxl__logv(libxl_ctx *ctx, xentoollog_level msglevel, int errnoval, -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |