Skip to content

Commit

Permalink
Don't use deprecated API anymore
Browse files Browse the repository at this point in the history
grn_column_index is deprecated since Groonga 5.0.1
  • Loading branch information
kenhys committed Apr 3, 2015
1 parent 74fdf75 commit 472cf93
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ext/groonga/rb-grn-column.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ rb_grn_column_get_indexes (int argc, VALUE *argv, VALUE self)
{
grn_ctx *context;
grn_obj *column;
grn_obj **indexes = NULL;
grn_index_datum *indexes = NULL;
int i, n_indexes;
grn_operator operator = GRN_OP_MATCH;
VALUE rb_operator, rb_indexes;
Expand All @@ -769,19 +769,18 @@ rb_grn_column_get_indexes (int argc, VALUE *argv, VALUE self)
}

rb_indexes = rb_ary_new();
n_indexes = grn_column_index(context, column, operator,
NULL, 0, NULL);
n_indexes = grn_column_find_index_data(context, column, operator, NULL, 0);
if (n_indexes == 0)
return rb_indexes;

indexes = xmalloc(sizeof(grn_obj *) * n_indexes);
n_indexes = grn_column_index(context, column, operator,
indexes, n_indexes, NULL);
indexes = xmalloc(sizeof(grn_index_datum) * n_indexes);
n_indexes = grn_column_find_index_data(context, column, operator,
indexes, n_indexes);
for (i = 0; i < n_indexes; i++) {
VALUE rb_index;
rb_index = GRNOBJECT2RVAL(Qnil, context, indexes[i], GRN_FALSE);
rb_index = GRNOBJECT2RVAL(Qnil, context, indexes[i].index, GRN_FALSE);
rb_ary_push(rb_indexes, rb_index);
grn_obj_unlink(context, indexes[i]);
grn_obj_unlink(context, indexes[i].index);
}
xfree(indexes);
return rb_indexes;
Expand Down

0 comments on commit 472cf93

Please sign in to comment.