예제 #1
0
static GList *
retrieve_all_keys_and_values(void)
{
  grn_id id;

  keys_and_values_free();

  id = grn_hash_cursor_next(context, cursor);
  while (id != GRN_ID_NIL) {
    int length;
    void *key, *value;
    GString *null_terminated_key, *null_terminated_value;

    length = grn_hash_cursor_get_key(context, cursor, &key);
    null_terminated_key = g_string_new_len(key, length);
    keys_and_values = g_list_append(keys_and_values,
                                    g_string_free(null_terminated_key, FALSE));

    length = grn_hash_cursor_get_value(context, cursor, &value);
    null_terminated_value = g_string_new_len(value, length);
    keys_and_values = g_list_append(keys_and_values,
                                    g_string_free(null_terminated_value, FALSE));

    id = grn_hash_cursor_next(context, cursor);
  }

  return keys_and_values;
}
예제 #2
0
void
cut_teardown(void)
{
  keys_free();
  keys_and_values_free();
  teardown_hash_common();
}
예제 #3
0
static GList *
retrieve_all_keys_and_values(void)
{
  keys_and_values_free();
  keys_and_values = grn_test_pat_cursor_get_pairs(context,
                                                  (grn_table_cursor *)cursor);
  return keys_and_values;
}