Re: [libvirt] [PATCH 1/2] virStrndup: Accept negative values as string length

2013-05-24 Thread Eric Blake
On 05/24/2013 03:53 AM, Michal Privoznik wrote: > It may shorten the code a bit as the following pattern: > > VIR_STRNDUP(dst, src, cond ? n : strlen(src)) > > is used on several places among our code. However, we can > move the strlen into virStrndup and thus write just: > > VIR_STRNDUP(dst

[libvirt] [PATCH 1/2] virStrndup: Accept negative values as string length

2013-05-24 Thread Michal Privoznik
It may shorten the code a bit as the following pattern: VIR_STRNDUP(dst, src, cond ? n : strlen(src)) is used on several places among our code. However, we can move the strlen into virStrndup and thus write just: VIR_STRNDUP(dst, src, cond ? n : -1) --- src/util/virstring.c | 7 ++- s