virJSONValueCopy: Don't use virJSONValue(Object|Array)Append
virJSONValueCopy: Don't use virJSONValue(Object|Array)Append

We know the exact number of keys or array members for the copied objects
so we can pre-allocate the arrays rather than inserting into them in a
loop incurring realloc copy penalty.

Also virJSONValueCopy now can't fail since all of the functions
allocating the different cases use just g_new/g_strdup internally so we
can remove the NULL checks from the recursive calls.

Signed-off-by: Peter Krempa <2cf5c04c61aa466e4a47bfedc747d17279c72ffc@redhat.com>
Reviewed-by: Michal Privoznik <83d82aaba2eed257f4814b0c239c260c4caaadf0@redhat.com>

nertpinx/libvirt,jfehlig/libvirt,libvirt/libvirt,jfehlig/libvirt,jfehlig/libvirt,libvirt/libvirt,olafhering/libvirt,crobinso/libvirt,zippy2/libvirt,crobinso/libvirt,libvirt/libvirt,zippy2/libvirt,crobinso/libvirt,nertpinx/libvirt,crobinso/libvirt,olafhering/libvirt,jfehlig/libvirt,olafhering/libvirt,libvirt/libvirt,nertpinx/libvirt,zippy2/libvirt,nertpinx/libvirt,olafhering/libvirt,zippy2/libvirt,nertpinx/libvirt