diff options
author | Ali Polatel <alip@exherbo.org> | 2010-05-26 20:56:07 +0300 |
---|---|---|
committer | Ali Polatel <alip@exherbo.org> | 2010-06-06 09:18:00 +0300 |
commit | 5c9e385591b66fa20cbb186393c48c52831a23b7 (patch) | |
tree | 2c87c8356373a958623e65ef311054799f09e5ea /bindings/ruby/messages.c | |
parent | d2a457a5d8238c54445a8a6066f79c112ebd3a04 (diff) |
ruby: Don't barf if an object is destroyed more than once
Raise RuntimeError instead.
Also revise Notmuch::Database a bit.
Add Notmuch::Database.open singleton method.
Diffstat (limited to 'bindings/ruby/messages.c')
-rw-r--r-- | bindings/ruby/messages.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bindings/ruby/messages.c b/bindings/ruby/messages.c index 94b0b0da..35b5d146 100644 --- a/bindings/ruby/messages.c +++ b/bindings/ruby/messages.c @@ -28,11 +28,12 @@ VALUE notmuch_rb_messages_destroy(VALUE self) { - notmuch_messages_t *fnames; + notmuch_messages_t *messages; - Data_Get_Struct(self, notmuch_messages_t, fnames); + Data_Get_Notmuch_Messages(self, messages); - notmuch_messages_destroy(fnames); + notmuch_messages_destroy(messages); + DATA_PTR(self) = NULL; return Qnil; } @@ -48,9 +49,7 @@ notmuch_rb_messages_each(VALUE self) notmuch_message_t *message; notmuch_messages_t *messages; - Data_Get_Struct(self, notmuch_messages_t, messages); - if (!messages) - return self; + Data_Get_Notmuch_Messages(self, messages); for (; notmuch_messages_valid(messages); notmuch_messages_move_to_next(messages)) { message = notmuch_messages_get(messages); @@ -71,7 +70,7 @@ notmuch_rb_messages_collect_tags(VALUE self) notmuch_tags_t *tags; notmuch_messages_t *messages; - Data_Get_Struct(self, notmuch_messages_t, messages); + Data_Get_Notmuch_Messages(self, messages); tags = notmuch_messages_collect_tags(messages); if (!tags) |