X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=bindings%2Fruby%2Fdatabase.c;h=409d54fa504e85e8f88037cf7b99f4dcdbf2eb89;hp=ba9a1391a50918f25ca2d1bc5921c4907666e11b;hb=9721343e5b75e0e5a305ef32358fd83dcde650b4;hpb=0a357fe4105b3ea936b41584cb40312e84a1e67a;ds=sidebyside diff --git a/bindings/ruby/database.c b/bindings/ruby/database.c index ba9a1391..409d54fa 100644 --- a/bindings/ruby/database.c +++ b/bindings/ruby/database.c @@ -42,6 +42,8 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) int create, mode; VALUE pathv, hashv; VALUE modev; + notmuch_database_t *database; + notmuch_status_t ret; /* Check arguments */ rb_scan_args (argc, argv, "11", &pathv, &hashv); @@ -73,9 +75,13 @@ notmuch_rb_database_initialize (int argc, VALUE *argv, VALUE self) } Check_Type (self, T_DATA); - DATA_PTR (self) = create ? notmuch_database_create (path) : notmuch_database_open (path, mode); - if (!DATA_PTR (self)) - rb_raise (notmuch_rb_eDatabaseError, "Failed to open database"); + if (create) + ret = notmuch_database_create (path, &database); + else + ret = notmuch_database_open (path, mode, &database); + notmuch_rb_status_raise (ret); + + DATA_PTR (self) = database; return self; }