Navigation Menu

Skip to content

Commit

Permalink
mrb: use index column object
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 8, 2014
1 parent 9b90547 commit 3758dab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/mrb/mrb_expr.c
Expand Up @@ -191,12 +191,12 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
mrb_accessor = grn_mrb_value_from_grn_obj(mrb, ec->value);
if (!mrb_nil_p(mrb_funcall(mrb, mrb_accessor, "next", 0))) {
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, ec->value),
grn_mrb_value_from_grn_obj(mrb, ec->value),
mrb_fixnum_value(sid),
mrb_fixnum_value(weight));
} else {
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, index),
grn_mrb_value_from_grn_obj(mrb, index),
mrb_fixnum_value(sid),
mrb_fixnum_value(weight));
}
Expand All @@ -208,7 +208,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
mrb_value mrb_ec = mrb_grn_expr_code_new(mrb, ec);
weight = mrb_fixnum(mrb_funcall(mrb, mrb_ec, "weight", 0));
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, index),
grn_mrb_value_from_grn_obj(mrb, index),
mrb_fixnum_value(sid),
mrb_fixnum_value(weight));
}
Expand All @@ -229,7 +229,7 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
weight = mrb_fixnum(mrb_funcall(mrb, mrb_ec, "weight", 0));
}
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, index),
grn_mrb_value_from_grn_obj(mrb, index),
mrb_fixnum_value(sid),
mrb_fixnum_value(weight));
break;
Expand All @@ -245,12 +245,12 @@ scan_info_build(grn_ctx *ctx, grn_obj *expr, int *n,
mrb_value mrb_accessor = grn_mrb_value_from_grn_obj(mrb, *p);
if (!mrb_nil_p(mrb_funcall(mrb, mrb_accessor, "next", 0))) {
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, *p),
mrb_accessor,
mrb_fixnum_value(sid),
mrb_fixnum_value(1));
} else {
mrb_funcall(mrb, mrb_si, "put_index", 3,
mrb_cptr_value(mrb, index),
grn_mrb_value_from_grn_obj(mrb, index),
mrb_fixnum_value(sid),
mrb_fixnum_value(1));
}
Expand Down Expand Up @@ -431,7 +431,7 @@ mrb_grn_scan_info_put_index(mrb_state *mrb, mrb_value self)

mrb_get_args(mrb, "oii", &mrb_index, &sid, &weight);
si = DATA_PTR(self);
index = mrb_cptr(mrb_index);
index = DATA_PTR(mrb_index);
grn_scan_info_put_index(ctx, si, index, sid, weight);
return self;
}
Expand Down
3 changes: 2 additions & 1 deletion lib/mrb/mrb_index_info.c
Expand Up @@ -25,6 +25,7 @@

#include "../db.h"
#include "mrb_index_info.h"
#include "mrb_converter.h"

mrb_value
mrb_grn_index_info_new(mrb_state *mrb, grn_obj *index, int section_id)
Expand All @@ -34,7 +35,7 @@ mrb_grn_index_info_new(mrb_state *mrb, grn_obj *index, int section_id)
struct RClass *klass;
mrb_value args[2];

args[0] = mrb_cptr_value(mrb, index);
args[0] = grn_mrb_value_from_grn_obj(mrb, index);
args[1] = mrb_fixnum_value(section_id);
klass = mrb_class_ptr(mrb_const_get(mrb, mrb_obj_value(module),
mrb_intern(mrb, "IndexInfo")));
Expand Down

0 comments on commit 3758dab

Please sign in to comment.