Skip to content

Commit

Permalink
Reduce allocated objects
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Mar 5, 2016
1 parent 7b7b529 commit c9665a0
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ext/groonga/rb-grn-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,18 +204,14 @@ rb_grn_config_each (VALUE self)
uint32_t key_size;
const char *value;
uint32_t value_size;
VALUE rb_key, rb_value, rb_key_value;
VALUE rb_key, rb_value;

key_size = grn_config_cursor_get_key(context, cursor, &key);
rb_key = rb_str_new(key, key_size);
value_size = grn_config_cursor_get_value(context, cursor, &value);
rb_value = rb_str_new(value, value_size);

rb_key_value = rb_ary_new();
rb_ary_push(rb_key_value, rb_key);
rb_ary_push(rb_key_value, rb_value);

rb_yield(rb_key_value);
rb_yield_values(2, rb_key, rb_value);
}

return Qnil;
Expand Down

0 comments on commit c9665a0

Please sign in to comment.