+ rarray->pdata[rarray->len++] = data;
+}
+
+/**
+ * g_ptr_array_insert:
+ * @array: a #GPtrArray
+ * @index_: the index to place the new element at, or -1 to append
+ * @data: the pointer to add.
+ *
+ * Inserts an element into the pointer array at the given index. The
+ * array will grow in size automatically if necessary.
+ *
+ * Since: 2.40
+ */
+void
+g_ptr_array_insert (GPtrArray *array,
+ gint index_,
+ gpointer data)
+{
+ GRealPtrArray *rarray = (GRealPtrArray *)array;
+
+ g_return_if_fail (rarray);
+ g_return_if_fail (index_ >= -1);
+ g_return_if_fail (index_ <= (gint)rarray->len);
+
+ g_ptr_array_maybe_expand (rarray, 1);
+
+ if (index_ < 0)
+ index_ = rarray->len;
+
+ if (index_ < rarray->len)
+ memmove (&(rarray->pdata[index_ + 1]),
+ &(rarray->pdata[index_]),
+ (rarray->len - index_) * sizeof (gpointer));
+
+ rarray->len++;
+ rarray->pdata[index_] = data;