[glib: 1/4] garray: Fix (nullable) annotation on GArray.[prepend|insert]_vals()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/4] garray: Fix (nullable) annotation on GArray.[prepend|insert]_vals()
- Date: Mon, 4 Jun 2018 10:35:27 +0000 (UTC)
commit 3eeec77800ab6019febe8fb73ec34533770752c5
Author: Philip Withnall <withnall endlessm com>
Date: Wed May 9 15:34:39 2018 +0100
garray: Fix (nullable) annotation on GArray.[prepend|insert]_vals()
They do both accept NULL value arrays, but only if the number of
elements in the value array is zero. Fix the annotations and mention
this in the documentation.
Signed-off-by: Philip Withnall <withnall endlessm com>
https://bugzilla.gnome.org/show_bug.cgi?id=795975
glib/garray.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/glib/garray.c b/glib/garray.c
index 914eaee34..5207eccc3 100644
--- a/glib/garray.c
+++ b/glib/garray.c
@@ -439,11 +439,14 @@ g_array_append_vals (GArray *farray,
/**
* g_array_prepend_vals:
* @array: a #GArray
- * @data: (not nullable): a pointer to the elements to prepend to the start of the array
- * @len: the number of elements to prepend
+ * @data: (nullable): a pointer to the elements to prepend to the start of the array
+ * @len: the number of elements to prepend, which may be zero
*
* Adds @len elements onto the start of the array.
*
+ * @data may be %NULL if (and only if) @len is zero. If @len is zero, this
+ * function is a no-op.
+ *
* This operation is slower than g_array_append_vals() since the
* existing elements in the array have to be moved to make space for
* the new elements.
@@ -498,11 +501,14 @@ g_array_prepend_vals (GArray *farray,
* g_array_insert_vals:
* @array: a #GArray
* @index_: the index to place the elements at
- * @data: (not nullable): a pointer to the elements to insert
+ * @data: (nullable): a pointer to the elements to insert
* @len: the number of elements to insert
*
* Inserts @len elements into a #GArray at the given index.
*
+ * @data may be %NULL if (and only if) @len is zero. If @len is zero, this
+ * function is a no-op.
+ *
* Returns: the #GArray
*/
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]