diff options
author | Kentoku SHIBA <kentokushiba@gmail.com> | 2015-04-30 04:44:30 +0900 |
---|---|---|
committer | Kentoku SHIBA <kentokushiba@gmail.com> | 2015-04-30 04:44:30 +0900 |
commit | a0fdb258a435290980993ae025a7fc19c09d2cdb (patch) | |
tree | 67023cf51c542ed78443d68e9c61b28b39583245 /storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c | |
parent | 060ec5b6b9384456695b6fc903ccfeb8c7ccd298 (diff) | |
download | mariadb-git-a0fdb258a435290980993ae025a7fc19c09d2cdb.tar.gz |
Update Mroonga to the latest version on 2015-04-30T04:44:30+0900
Diffstat (limited to 'storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c')
-rw-r--r-- | storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c index bd288af8491..daa0caada06 100644 --- a/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c +++ b/storage/mroonga/vendor/groonga/lib/mrb/mrb_accessor.c @@ -1,6 +1,6 @@ /* -*- c-basic-offset: 2 -*- */ /* - Copyright(C) 2013-2014 Brazil + Copyright(C) 2013-2015 Brazil This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,7 @@ #include "../grn_db.h" #include "mrb_accessor.h" +#include "mrb_converter.h" static struct mrb_data_type mrb_grn_accessor_type = { "Groonga::Accessor", @@ -49,8 +50,25 @@ mrb_grn_accessor_next(mrb_state *mrb, mrb_value self) grn_accessor *accessor; accessor = DATA_PTR(self); - if (!accessor->next) { return mrb_nil_value(); } - return mrb_cptr_value(mrb, accessor->next); + return grn_mrb_value_from_grn_obj(mrb, (grn_obj *)(accessor->next)); +} + +static mrb_value +mrb_grn_accessor_have_next_p(mrb_state *mrb, mrb_value self) +{ + grn_accessor *accessor; + + accessor = DATA_PTR(self); + return mrb_bool_value(accessor->next != NULL); +} + +static mrb_value +mrb_grn_accessor_object(mrb_state *mrb, mrb_value self) +{ + grn_accessor *accessor; + + accessor = DATA_PTR(self); + return grn_mrb_value_from_grn_obj(mrb, accessor->obj); } void @@ -67,5 +85,9 @@ grn_mrb_accessor_init(grn_ctx *ctx) mrb_grn_accessor_initialize, MRB_ARGS_REQ(1)); mrb_define_method(mrb, klass, "next", mrb_grn_accessor_next, MRB_ARGS_NONE()); + mrb_define_method(mrb, klass, "have_next?", + mrb_grn_accessor_have_next_p, MRB_ARGS_NONE()); + mrb_define_method(mrb, klass, "object", + mrb_grn_accessor_object, MRB_ARGS_NONE()); } #endif |