From 149a58581c21d74df4e27b8d21d4c974f9f1677a Mon Sep 17 00:00:00 2001 From: pancake Date: Wed, 28 Sep 2011 11:50:20 +0200 Subject: [PATCH] * Fix list iterators for Vala 0.16 (and probably 0.14 too) --- libr/include/r_list.h | 1 + r2-bindings/vapi/r_util.vapi | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/libr/include/r_list.h b/libr/include/r_list.h index 13bc3ba7f4..08058418e9 100644 --- a/libr/include/r_list.h +++ b/libr/include/r_list.h @@ -41,6 +41,7 @@ typedef struct r_oflist_t { #define r_list_iter_next(x) (x?1:0) #define r_list_iter_cur(x) x->p #define r_list_iter_unref(x) x +#define r_list_iter_free(x) x R_API RList *r_list_new(); R_API RListIter *r_list_append(RList *list, void *data); R_API RListIter *r_list_prepend(RList *list, void *data); diff --git a/r2-bindings/vapi/r_util.vapi b/r2-bindings/vapi/r_util.vapi index 64afbfb65e..babd1ad789 100644 --- a/r2-bindings/vapi/r_util.vapi +++ b/r2-bindings/vapi/r_util.vapi @@ -127,12 +127,27 @@ public class RList { public unowned G pop(); } -//[Compact] +[Compact] [CCode (cprefix="r_list_iter_", cheader_filename="r_list.h", cname="struct r_list_iter_t")] public class RListIter { - public bool next(); + public RListIter n; + public RListIter p; + public G data; + // public G @free(G arg); +/* + public bool next(); public unowned G get(); +*/ + + [ReturnsModifiedPointer, CCode (cname = "_vala_r_list_iter_next")] + public bool next() { + return (bool)this.n; + } + [CCode (cname = "_vala_r_list_iter_get")] + public G get () { + return this.data; + } } [Compact]