[Groonga-commit] groonga/groonga at d744eef [master] Declare variables in block head

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Oct 24 15:50:16 JST 2016


Kouhei Sutou	2016-10-24 15:50:16 +0900 (Mon, 24 Oct 2016)

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

  Message:
    Declare variables in block head

  Modified files:
    lib/ii.c
    lib/ts/ts_expr_node.c
    lib/ts/ts_sorter.c

  Modified: lib/ii.c (+3 -2)
===================================================================
--- lib/ii.c    2016-10-22 00:11:55 +0900 (d78d222)
+++ lib/ii.c    2016-10-24 15:50:16 +0900 (ba42d2a)
@@ -11174,9 +11174,10 @@ grn_ii_builder_append_value(grn_ctx *ctx, grn_ii_builder *builder,
         break;
       }
       if (tid != GRN_ID_NIL) {
+        grn_rc rc;
         pos = builder->pos;
-        grn_rc rc = grn_ii_builder_append_token(ctx, builder, rid, sid,
-                                                weight, tid, pos);
+        rc = grn_ii_builder_append_token(ctx, builder, rid, sid,
+                                         weight, tid, pos);
         if (rc != GRN_SUCCESS) {
           return rc;
         }

  Modified: lib/ts/ts_expr_node.c (+2 -1)
===================================================================
--- lib/ts/ts_expr_node.c    2016-10-22 00:11:55 +0900 (c4d4b9e)
+++ lib/ts/ts_expr_node.c    2016-10-24 15:50:16 +0900 (44378cf)
@@ -2253,10 +2253,11 @@ grn_ts_expr_const_node_open(grn_ctx *ctx, grn_ts_data_kind data_kind,
                             grn_ts_any value, grn_ts_expr_node **node)
 {
   grn_rc rc = grn_ts_expr_const_node_check_value(ctx, data_kind, value);
+  grn_ts_expr_const_node *new_node;
   if (rc != GRN_SUCCESS) {
     return rc;
   }
-  grn_ts_expr_const_node *new_node = GRN_MALLOCN(grn_ts_expr_const_node, 1);
+  new_node = GRN_MALLOCN(grn_ts_expr_const_node, 1);
   if (!new_node) {
     GRN_TS_ERR_RETURN(GRN_NO_MEMORY_AVAILABLE,
                       "GRN_MALLOCN failed: %" GRN_FMT_SIZE " x 1",

  Modified: lib/ts/ts_sorter.c (+42 -16)
===================================================================
--- lib/ts/ts_sorter.c    2016-10-22 00:11:55 +0900 (7c37a37)
+++ lib/ts/ts_sorter.c    2016-10-24 15:50:16 +0900 (6136afb)
@@ -195,9 +195,12 @@ grn_ts_qsort_by_id_asc(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    grn_ts_record pivot;
+    size_t left, right;
     grn_ts_move_pivot_by_id_asc(recs, n_recs);
-    grn_ts_record pivot = recs[0];
-    size_t left = 1, right = n_recs;
+    pivot = recs[0];
+    left = 1;
+    right = n_recs;
     for ( ; ; ) {
       /* Move prior records to left. */
       while (left < right) {
@@ -327,9 +330,12 @@ grn_ts_qsort_by_id_desc(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    grn_ts_record pivot;
+    size_t left, right;
     grn_ts_move_pivot_by_id_desc(recs, n_recs);
-    grn_ts_record pivot = recs[0];
-    size_t left = 1, right = n_recs;
+    pivot = recs[0];
+    left = 1;
+    right = n_recs;
     for ( ; ; ) {
       /* Move prior records to left. */
       while (left < right) {
@@ -496,10 +502,15 @@ grn_ts_qsort_by_score_asc(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    grn_ts_record pivot;
+    size_t left, right;
+    size_t pivot_left, pivot_right;
     grn_ts_move_pivot_by_score_asc(recs, n_recs);
-    grn_ts_record pivot = recs[0];
-    size_t left = 1, right = n_recs;
-    size_t pivot_left = 1, pivot_right = n_recs;
+    pivot = recs[0];
+    left = 1;
+    right = n_recs;
+    pivot_left = 1;
+    pivot_right = n_recs;
     for ( ; ; ) {
       /*
        * Prior entries are moved to left. Less prior entries are moved to
@@ -900,10 +911,15 @@ grn_ts_qsort_by_int(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    grn_ts_int pivot;
+    size_t left, right;
+    size_t pivot_left, pivot_right;
     grn_ts_move_pivot_by_int(node, vals, recs, n_recs);
-    grn_ts_int pivot = vals[0];
-    size_t left = 1, right = n_recs;
-    size_t pivot_left = 1, pivot_right = n_recs;
+    pivot = vals[0];
+    left = 1;
+    right = n_recs;
+    pivot_left = 1;
+    pivot_right = n_recs;
     for ( ; ; ) {
       /*
        * Prior entries are moved to left. Less prior entries are moved to
@@ -1339,10 +1355,15 @@ grn_ts_qsort_by_text_desc(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    grn_ts_text pivot;
+    size_t left, right;
+    size_t pivot_left, pivot_right;
     grn_ts_move_pivot_by_text_desc(node, vals, recs, n_recs);
-    grn_ts_text pivot = vals[0];
-    size_t left = 1, right = n_recs;
-    size_t pivot_left = 1, pivot_right = n_recs;
+    pivot = vals[0];
+    left = 1;
+    right = n_recs;
+    pivot_left = 1;
+    pivot_right = n_recs;
     for ( ; ; ) {
       /*
        * Prior entries are moved to left. Less prior entries are moved to
@@ -1572,10 +1593,15 @@ grn_ts_qsort_by_text_asc2(grn_ctx *ctx, grn_ts_sorter_node *node,
    *        This value should be optimized and replaced with a named constant.
    */
   while (n_recs >= 16) {
+    int pivot;
+    size_t left, right;
+    size_t pivot_left, pivot_right;
     grn_ts_move_pivot_by_text_asc2(node, vals, recs, n_recs, depth);
-    int pivot = grn_ts_text_get_label(vals[0], depth);
-    size_t left = 1, right = n_recs;
-    size_t pivot_left = 1, pivot_right = n_recs;
+    pivot = grn_ts_text_get_label(vals[0], depth);
+    left = 1;
+    right = n_recs;
+    pivot_left = 1;
+    pivot_right = n_recs;
     for ( ; ; ) {
       /*
        * Prior entries are moved to left. Less prior entries are moved to
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index