[Groonga-commit] groonga/groonga at 7be54e6 [master] mrb: add Column#locked?

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Dec 28 21:11:22 JST 2014


Kouhei Sutou	2014-12-28 21:11:22 +0900 (Sun, 28 Dec 2014)

  New Revision: 7be54e60540ab878356391017d6987d82a44b986
  https://github.com/groonga/groonga/commit/7be54e60540ab878356391017d6987d82a44b986

  Message:
    mrb: add Column#locked?

  Modified files:
    lib/mrb/mrb_column.c

  Modified: lib/mrb/mrb_column.c (+18 -1)
===================================================================
--- lib/mrb/mrb_column.c    2014-12-28 21:09:53 +0900 (9609a18)
+++ lib/mrb/mrb_column.c    2014-12-28 21:11:22 +0900 (7e9eccf)
@@ -1,6 +1,6 @@
 /* -*- c-basic-offset: 2 -*- */
 /*
-  Copyright(C) 2013 Brazil
+  Copyright(C) 2013-2014 Brazil
 
   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
@@ -21,9 +21,23 @@
 #ifdef GRN_WITH_MRUBY
 #include <mruby.h>
 #include <mruby/class.h>
+#include <mruby/data.h>
 
+#include "mrb_ctx.h"
 #include "mrb_column.h"
 
+static mrb_value
+mrb_grn_column_is_locked(mrb_state *mrb, mrb_value self)
+{
+  grn_ctx *ctx = (grn_ctx *)mrb->ud;
+  unsigned int is_locked;
+
+  is_locked = grn_obj_is_locked(ctx, DATA_PTR(self));
+  grn_mrb_ctx_check(mrb);
+
+  return mrb_bool_value(is_locked != 0);
+}
+
 void
 grn_mrb_column_init(grn_ctx *ctx)
 {
@@ -35,5 +49,8 @@ grn_mrb_column_init(grn_ctx *ctx)
 
   klass = mrb_define_class_under(mrb, module, "Column", object_class);
   MRB_SET_INSTANCE_TT(klass, MRB_TT_DATA);
+
+  mrb_define_method(mrb, klass, "locked?",
+                    mrb_grn_column_is_locked, MRB_ARGS_NONE());
 }
 #endif
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index