mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
util: use glib string allocation/formatting functions
Convert the string duplication APIs to use the g_strdup family of APIs. We previously used the 'strdup-posix' gnulib module because mingw does not set errno to ENOMEM on failure We previously used the 'strndup' gnulib module because this function does not exist on mingw. We previously used the 'vasprintf' gnulib module because of many GNU supported format specifiers not working on non-Linux platforms. glib's own equivalent standardizes on GNU format specifiers too. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
@@ -1020,6 +1020,14 @@ BAD:
|
||||
classic libvirt memory allocation APIs and GLib APIs within
|
||||
a single method. Keep the style consistent, converting existing
|
||||
code to GLib style in a separate, prior commit.</dd>
|
||||
|
||||
<dt>VIR_STRDUP, VIR_STRNDUP</dt>
|
||||
<dd>Prefer the GLib APIs g_strdup and g_strndup.</dd>
|
||||
|
||||
<dt>virAsprintf, virVasprintf</dt>
|
||||
<dd>The GLib APIs g_strdup_printf / g_strdup_vprint should be used
|
||||
instead. Don't use g_vasprintf unless having the string length
|
||||
returned is unavoidable.</dd>
|
||||
</dl>
|
||||
|
||||
<h2><a id="file_handling">File handling</a></h2>
|
||||
|
||||
Reference in New Issue
Block a user