X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fruby%2Fdefs.h;h=9860ee17d9479e1bc1101978585ed986e0e704c1;hp=fa7b9515c9a8347e895a596b9a3f6b136925114a;hb=5f49e3421f5d1f98951b55dd5ba106c2a106aba7;hpb=9574fb60991fa81799fbd1d26d41693ca2794e6b diff --git a/bindings/ruby/defs.h b/bindings/ruby/defs.h index fa7b9515..9860ee17 100644 --- a/bindings/ruby/defs.h +++ b/bindings/ruby/defs.h @@ -105,6 +105,21 @@ extern const rb_data_type_t notmuch_rb_tags_type; #define Data_Get_Notmuch_Tags(obj, ptr) \ Data_Get_Notmuch_Object ((obj), ¬much_rb_tags_type, (ptr)) +static inline notmuch_status_t +notmuch_rb_object_destroy (VALUE rb_object, const rb_data_type_t *type) +{ + void *nm_object; + notmuch_status_t ret; + + Data_Get_Notmuch_Object (rb_object, type, nm_object); + + /* Call the corresponding notmuch_*_destroy function */ + ret = ((notmuch_status_t (*)(void *)) type->data) (nm_object); + DATA_PTR (rb_object) = NULL; + + return ret; +} + /* status.c */ void notmuch_rb_status_raise (notmuch_status_t status);