[libvirt PATCH 4/6] docs: glib-adoption: split into sections
Andrea Bolognani
abologna at redhat.com
Thu Oct 1 14:46:51 UTC 2020
On Thu, 2020-09-24 at 14:28 +0200, Ján Tomko wrote:
> +Memory allocation
> + ``VIR_ALLOC``, ``VIR_REALLOC``, ``VIR_RESIZE_N``,
> + ``VIR_EXPAND_N``, ``VIR_SHRINK_N``, ``VIR_FREE``
> +
> Prefer the GLib APIs ``g_new0``/``g_renew``/ ``g_free`` in most
> - cases. There should rarely be a need to use
> - ``g_malloc``/``g_realloc``. Instead of using plain C arrays, it
> - is preferrable to use one of the GLib types, ``GArray``,
> - ``GPtrArray`` or ``GByteArray``. These all use a struct to
> - track the array memory and size together and efficiently
> - resize. **NEVER MIX** use of the 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.
> + cases. There should rarely be a need to use
> + ``g_malloc``/``g_realloc``. **NEVER MIX** use of the 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.
Part of this hunk is the result not of actual changes in the
contents, but rather of switching to two-spaces-between-sentences
style, which is incidentally not the style used in the rest of the
file. So, please don't do that :)
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list