mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
docs: hacking: mention GLib alternatives of libvirt string allocation macros
Document the preferred alternatives to existing libvirt macros for allocating strings. These cannot be deleted just yet because converting them will require a lot of work. Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
parent
48f48b27af
commit
95f3a1fe3c
@ -1072,6 +1072,18 @@ BAD:
|
||||
<tr><td><code>VIR_FREE</code></td><td><code>g_free</code></td>
|
||||
<td><code>g_free</code> does not zero the pointer</td></tr>
|
||||
</table>
|
||||
|
||||
<p>String allocation macros and functions:</p>
|
||||
<table class="top_table">
|
||||
<tr><th>deprecated version</th><th>GLib version</th><th>Notes</th></tr>
|
||||
<tr><td><code>VIR_STRDUP</code></td><td><code>g_strdup</code></td><td></td></tr>
|
||||
<tr><td><code>VIR_STRNDUP</code></td><td><code>g_strndup</code></td><td></td></tr>
|
||||
<tr><td><code>virAsprintf</code></td><td><code>g_strdup_printf</code></td><td></td></tr>
|
||||
<tr><td><code>virVasprintf</code></td><td><code>g_strdup_vprint</code></td>
|
||||
<td>use <code>g_vasprintf</code> if you really need to know the returned length</td></tr>
|
||||
<tr><td><code>virStrerror</code></td><td><code>g_strerror</code></td>
|
||||
<td>the error strings are cached globally so no need to free it</td></tr>
|
||||
</table>
|
||||
</dl>
|
||||
|
||||
<p>
|
||||
|
Loading…
Reference in New Issue
Block a user