summaryrefslogtreecommitdiff
path: root/vapi
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-07-27 16:25:44 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2018-07-27 16:25:44 +0200
commita62bda136d404743305161326390f3db3880c9d5 (patch)
treee1bfd8f28de49f6e343044907af7a37c5bfe7fbe /vapi
parent64cca878abe575a583164f2ae42817200d3ecf0b (diff)
downloadvala-a62bda136d404743305161326390f3db3880c9d5.tar.gz
glib-2.0: Add Array.remove*() wrapper to avoid leaking generic elements
Diffstat (limited to 'vapi')
-rw-r--r--vapi/glib-2.0.vapi33
1 files changed, 30 insertions, 3 deletions
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index c8c5fa2ea..147a7148d 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -5224,9 +5224,36 @@ namespace GLib {
public void prepend_vals (void* data, uint len);
public void insert_val (uint index, owned G value);
public void insert_vals (uint index, void* data, uint len);
- public void remove_index (uint index);
- public void remove_index_fast (uint index);
- public void remove_range (uint index, uint length);
+ [CCode (cname = "g_array_remove_index")]
+ public void _remove_index (uint index);
+ [CCode (cname = "g_array_remove_index_fast")]
+ public void _remove_index_fast (uint index);
+ [CCode (cname = "g_array_remove_range")]
+ public void _remove_range (uint index, uint length);
+ [CCode (cname = "vala_g_array_remove_index")]
+ public G remove_index (uint index) {
+ assert (length > index);
+ G g = data[index];
+ _remove_index (index);
+ return g;
+ }
+ [CCode (cname = "vala_g_array_remove_index_fast")]
+ public G remove_index_fast (uint index) {
+ assert (length > index);
+ G g = data[index];
+ _remove_index_fast (index);
+ return g;
+ }
+ [CCode (cname = "vala_g_array_remove_range")]
+ public G[] remove_range (uint index, uint length) {
+ assert (this.length >= index + length);
+ G[] ga = new G[length];
+ for (uint i = 0; i < length; i++) {
+ ga[i] = data[i + index];
+ }
+ _remove_range (index, length);
+ return ga;
+ }
public void sort (CompareFunc<G> compare_func);
public void sort_with_data (CompareDataFunc<G> compare_func);
[CCode (generic_type_pos = 0.1)]