[Groonga-commit] groonga/groonga at e17e2f6 [master] hash: grn_hash_get_value_() doesn't require size location

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Fri May 13 10:26:12 JST 2016


Kouhei Sutou	2016-05-13 10:26:12 +0900 (Fri, 13 May 2016)

  New Revision: e17e2f62780a410b92cabb50047f285c1eff5b9c
  https://github.com/groonga/groonga/commit/e17e2f62780a410b92cabb50047f285c1eff5b9c

  Message:
    hash: grn_hash_get_value_() doesn't require size location
    
    Because there are use cases that don't use size.

  Modified files:
    lib/command.c
    lib/expr.c
    lib/hash.c
    lib/plugin.c
    lib/proc/proc_select.c
    lib/ts/ts_util.c

  Modified: lib/command.c (+1 -2)
===================================================================
--- lib/command.c    2016-05-12 18:29:35 +0900 (282d15b)
+++ lib/command.c    2016-05-13 10:26:12 +0900 (82db217)
@@ -122,9 +122,8 @@ grn_command_input_at(grn_ctx *ctx,
 
   GRN_API_ENTER;
   if (input->arguments) {
-    uint32_t size;
     argument = (grn_obj *)grn_hash_get_value_(ctx, input->arguments,
-                                              offset + 1, &size);
+                                              offset + 1, NULL);
   }
   GRN_API_RETURN(argument);
 }

  Modified: lib/expr.c (+1 -1)
===================================================================
--- lib/expr.c    2016-05-12 18:29:35 +0900 (03c5dcc)
+++ lib/expr.c    2016-05-13 10:26:12 +0900 (e226992)
@@ -704,7 +704,7 @@ grn_expr_get_var_by_offset(grn_ctx *ctx, grn_obj *expr, unsigned int offset)
   uint32_t n;
   grn_obj *res = NULL;
   grn_hash *vars = grn_expr_get_vars(ctx, expr, &n);
-  if (vars) { res = (grn_obj *)grn_hash_get_value_(ctx, vars, offset + 1, &n); }
+  if (vars) { res = (grn_obj *)grn_hash_get_value_(ctx, vars, offset + 1, NULL); }
   return res;
 }
 

  Modified: lib/hash.c (+3 -1)
===================================================================
--- lib/hash.c    2016-05-12 18:29:35 +0900 (8a88cc3)
+++ lib/hash.c    2016-05-13 10:26:12 +0900 (5ee6dc9)
@@ -2671,7 +2671,9 @@ grn_hash_get_value_(grn_ctx *ctx, grn_hash *hash, grn_id id, uint32_t *size)
   if (!value) {
     return NULL;
   }
-  *size = hash->value_size;
+  if (size) {
+    *size = hash->value_size;
+  }
   return (const char *)value;
 }
 

  Modified: lib/plugin.c (+1 -3)
===================================================================
--- lib/plugin.c    2016-05-12 18:29:35 +0900 (0d38592)
+++ lib/plugin.c    2016-05-13 10:26:12 +0900 (3148c98)
@@ -904,9 +904,7 @@ grn_plugin_ensure_registered(grn_ctx *ctx, grn_obj *proc)
   CRITICAL_SECTION_ENTER(grn_plugins_lock);
   {
     const char *value;
-    uint32_t value_size;
-    value = grn_hash_get_value_(&grn_plugins_ctx, grn_plugins, plugin_id,
-                                &value_size);
+    value = grn_hash_get_value_(&grn_plugins_ctx, grn_plugins, plugin_id, NULL);
     if (value) {
       plugin = *((grn_plugin **)value);
     }

  Modified: lib/proc/proc_select.c (+5 -9)
===================================================================
--- lib/proc/proc_select.c    2016-05-12 18:29:35 +0900 (4653bb6)
+++ lib/proc/proc_select.c    2016-05-13 10:26:12 +0900 (e53d824)
@@ -932,11 +932,10 @@ grn_select_drilldown_execute(grn_ctx *ctx,
   unsigned int n_keys = 0;
   grn_obj *target_table = table;
   grn_drilldown_data *drilldown;
-  uint32_t size;
   grn_table_group_result *result;
 
   drilldown =
-    (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, id, &size);
+    (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, id, NULL);
   result = &(drilldown->result);
 
   result->limit = 1;
@@ -974,7 +973,7 @@ grn_select_drilldown_execute(grn_ctx *ctx,
         (grn_drilldown_data *)grn_hash_get_value_(ctx,
                                                   drilldowns,
                                                   dependent_id,
-                                                  &size);
+                                                  NULL);
       dependent_result = &(dependent_drilldown->result);
       target_table = dependent_result->table;
     }
@@ -1105,12 +1104,11 @@ grn_select_drilldown(grn_ctx *ctx,
 {
   grn_id first_id = 1;
   grn_drilldown_data *drilldown;
-  uint32_t size;
   grn_table_group_result *result;
   uint32_t i;
 
   drilldown =
-    (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, first_id, &size);
+    (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, first_id, NULL);
   if (!drilldown) {
     return;
   }
@@ -1228,9 +1226,8 @@ drilldown_tsort_visit(grn_ctx *ctx,
     statuses[index] = TSORT_STATUS_VISITING;
     {
       grn_drilldown_data *drilldown;
-      uint32_t size;
       drilldown =
-        (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, id, &size);
+        (grn_drilldown_data *)grn_hash_get_value_(ctx, drilldowns, id, NULL);
       if (drilldown->table_name.length > 0) {
         grn_id dependent_id;
         dependent_id = grn_hash_get(ctx, drilldowns,
@@ -1750,12 +1747,11 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
         grn_drilldown_data *anonymous_drilldown = NULL;
         if (grn_hash_size(ctx, data->drilldowns) == 1) {
           grn_id first_id = 1;
-          uint32_t size;
           anonymous_drilldown =
             (grn_drilldown_data *)grn_hash_get_value_(ctx,
                                                       data->drilldowns,
                                                       first_id,
-                                                      &size);
+                                                      NULL);
           if (anonymous_drilldown) {
             if (anonymous_drilldown->label.length > 0) {
               anonymous_drilldown = NULL;

  Modified: lib/ts/ts_util.c (+1 -2)
===================================================================
--- lib/ts/ts_util.c    2016-05-12 18:29:35 +0900 (fc523f2)
+++ lib/ts/ts_util.c    2016-05-13 10:26:12 +0900 (9e85aa4)
@@ -112,8 +112,7 @@ grn_ts_table_get_value(grn_ctx *ctx, grn_obj *table, grn_ts_id id)
 {
   switch (table->header.type) {
     case GRN_TABLE_HASH_KEY: {
-      uint32_t size;
-      return grn_hash_get_value_(ctx, (grn_hash *)table, id, &size);
+      return grn_hash_get_value_(ctx, (grn_hash *)table, id, NULL);
     }
     case GRN_TABLE_PAT_KEY: {
       uint32_t size;
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る