[Groonga-commit] groonga/groonga at f3d9a8c [master] select: simplify

アーカイブの一覧に戻る

Kouhei Sutou null+****@clear*****
Tue May 24 17:04:38 JST 2016


Kouhei Sutou	2016-05-24 17:04:38 +0900 (Tue, 24 May 2016)

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

  Message:
    select: simplify

  Modified files:
    lib/proc/proc_select.c

  Modified: lib/proc/proc_select.c (+23 -15)
===================================================================
--- lib/proc/proc_select.c    2016-05-24 17:01:01 +0900 (580609e)
+++ lib/proc/proc_select.c    2016-05-24 17:04:38 +0900 (36fff15)
@@ -2248,6 +2248,24 @@ grn_select_output_drilldowns(grn_ctx *ctx,
   return succeeded;
 }
 
+static grn_bool
+grn_select_output(grn_ctx *ctx, grn_select_data *data)
+{
+  if (!grn_select_output_records(ctx, data)) {
+    return GRN_FALSE;
+  }
+
+  if (!grn_select_output_slices(ctx, data)) {
+    return GRN_FALSE;
+  }
+
+  if (!grn_select_output_drilldowns(ctx, data)) {
+    return GRN_FALSE;
+  }
+
+  return GRN_TRUE;
+}
+
 static grn_rc
 grn_select(grn_ctx *ctx, grn_select_data *data)
 {
@@ -2474,6 +2492,8 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
     }
 
     {
+      grn_bool succeeded;
+
       /* For select results */
       data->output.n_elements = 1;
 
@@ -2501,23 +2521,11 @@ grn_select(grn_ctx *ctx, grn_select_data *data)
       }
 
       GRN_OUTPUT_ARRAY_OPEN("RESULT", data->output.n_elements);
-
-      if (!grn_select_output_records(ctx, data)) {
-        GRN_OUTPUT_ARRAY_CLOSE();
-        goto exit;
-      }
-
-      if (!grn_select_output_slices(ctx, data)) {
-        GRN_OUTPUT_ARRAY_CLOSE();
-        goto exit;
-      }
-
-      if (!grn_select_output_drilldowns(ctx, data)) {
-        GRN_OUTPUT_ARRAY_CLOSE();
+      succeeded = grn_select_output(ctx, data);
+      GRN_OUTPUT_ARRAY_CLOSE();
+      if (!succeeded) {
         goto exit;
       }
-
-      GRN_OUTPUT_ARRAY_CLOSE();
     }
     if (!ctx->rc &&
         data->cacheable &&
-------------- next part --------------
HTML����������������������������...
ダウンロード 



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