From 674f6dcb9d4346fc497235fef83a7ffab5bb19ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Thu, 24 Sep 2020 14:07:20 +0200 Subject: [PATCH] docs: glib-adoption: add links to GLib documentation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make life a bit easier for people unfamiliar with GLib. Signed-off-by: Ján Tomko Reviewed-by: Andrea Bolognani --- docs/glib-adoption.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/glib-adoption.rst b/docs/glib-adoption.rst index 4c389d7a34..1cf5b9cf9b 100644 --- a/docs/glib-adoption.rst +++ b/docs/glib-adoption.rst @@ -18,6 +18,8 @@ Memory allocation ``VIR_ALLOC``, ``VIR_REALLOC``, ``VIR_RESIZE_N``, ``VIR_EXPAND_N``, ``VIR_SHRINK_N``, ``VIR_FREE`` + https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html + 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``. **NEVER MIX** use of the classic @@ -28,6 +30,8 @@ Memory allocation Array operations ``VIR_APPEND_ELEMENT``, ``VIR_INSERT_ELEMENT``, ``VIR_DELETE_ELEMENT`` + https://developer.gnome.org/glib/stable/glib-Arrays.html + 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