Re: [Qemu-devel] [PATCH] 9pfs-local: simplify/optimize local_mapped_attr_path()

2015-03-11 Thread Michael Tokarev
10.03.2015 20:30, Aneesh Kumar K.V wrote: > Michael Tokarev writes: > >> Omit one unnecessary memory allocation for components of the path >> and create the resulting path directly given lengths of the components. >> >> This uses (char*) cast because basename() accepts a char* without const, >> f

Re: [Qemu-devel] [PATCH] 9pfs-local: simplify/optimize local_mapped_attr_path()

2015-03-10 Thread Aneesh Kumar K.V
Michael Tokarev writes: > Omit one unnecessary memory allocation for components of the path > and create the resulting path directly given lengths of the components. > > This uses (char*) cast because basename() accepts a char* without const, > for unknown reason. Maybe it is better to use strrc

Re: [Qemu-devel] [PATCH] 9pfs-local: simplify/optimize local_mapped_attr_path()

2015-03-09 Thread Michael Tokarev
05.03.2015 04:13, Fam Zheng wrote: > On Thu, 03/05 00:03, Michael Tokarev wrote: >> +const char *name = basename((char*)path); > > checkpatch.pl complained this, s/char*/char */ I've fixed it in git. Thank you for spotting this. /mjt

Re: [Qemu-devel] [PATCH] 9pfs-local: simplify/optimize local_mapped_attr_path()

2015-03-04 Thread Fam Zheng
On Thu, 03/05 00:03, Michael Tokarev wrote: > +const char *name = basename((char*)path); checkpatch.pl complained this, s/char*/char */

[Qemu-devel] [PATCH] 9pfs-local: simplify/optimize local_mapped_attr_path()

2015-03-04 Thread Michael Tokarev
Omit one unnecessary memory allocation for components of the path and create the resulting path directly given lengths of the components. This uses (char*) cast because basename() accepts a char* without const, for unknown reason. Maybe it is better to use strrchr(), but I'm not sure for various