]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: buffer: Simplify escape buffer allocations
authorPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 06:49:57 +0000 (08:49 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 24 Oct 2019 17:35:34 +0000 (19:35 +0200)
commit241057681ab9ea67c122bae58293e07c90f80824
tree2f068585b1b530a3ef90ae3def30282cf538a1a2
parentff06e8340751e965c3415436c0d0668bef86b7e8
util: buffer: Simplify escape buffer allocations

Replace combinations of xalloc_oversized and VIR_ALLOC_N_QUIET by using
g_malloc0_n which does the checking internally.

This conversion is done with a semantic difference and slightly higher
memory requirements as I've opted to allocate one chunk more than
necessary rather than trying to accomodate the NUL byte separately.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virbuffer.c