X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fruby%2Fdatabase.c;fp=bindings%2Fruby%2Fdatabase.c;h=9c3dbd96f0b292f856c2ccca2448b8483503a568;hp=1cf4e4e27c170e45f2e332b3e2d5e61c93646a9d;hb=7415b53fa568a3156ae3e3a47544a4784e024653;hpb=e8fa42a97a2e98fecb5cabdbeac6c7ad0b936b7d diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index 1cf4e4e2..9c3dbd96 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -26,6 +26,19 @@ notmuch_rb_database_alloc (VALUE klass) return Data_Wrap_Notmuch_Object (klass, ¬much_rb_database_type, NULL); } +/* + * call-seq: DB.destroy => nil + * + * Destroys the database, freeing all resources allocated for it. + */ +VALUE +notmuch_rb_database_destroy (VALUE self) +{ + notmuch_rb_object_destroy (self, ¬much_rb_database_type); + + return Qnil; +} + /* * call-seq: Notmuch::Database.new(path [, {:create => false, :mode => Notmuch::MODE_READ_ONLY}]) => DB * @@ -113,8 +126,12 @@ notmuch_rb_database_open (int argc, VALUE *argv, VALUE klass) VALUE notmuch_rb_database_close (VALUE self) { + notmuch_database_t *db; notmuch_status_t ret; - ret = notmuch_rb_object_destroy (self, ¬much_rb_database_type); + + Data_Get_Notmuch_Database (self, db); + + ret = notmuch_database_close (db); notmuch_rb_status_raise (ret); return Qnil;