]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virStrndup: Accept negative values as string length
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 24 May 2013 08:45:57 +0000 (10:45 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 24 May 2013 14:59:30 +0000 (16:59 +0200)
commitc93571968be190eabcf1c06f46f1a5bb1031f231
tree860b434d67f8051857ad5a8491bbd7c34a2451f1
parent267915ee69a74804f203e94dee3acafdc2b3a43d
virStrndup: Accept negative values as string length

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
src/util/virstring.h
tests/virstringtest.c