[Groonga-commit] groonga/groonga at 2fcf3b9 [master] Remove duplicated code

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Mar 28 15:26:43 JST 2018


Kouhei Sutou	2018-03-28 15:26:43 +0900 (Wed, 28 Mar 2018)

  New Revision: 2fcf3b99e6a9801a959d1a99c82df1e16e89b2be
  https://github.com/groonga/groonga/commit/2fcf3b99e6a9801a959d1a99c82df1e16e89b2be

  Message:
    Remove duplicated code

  Modified files:
    lib/db.c

  Modified: lib/db.c (+9 -13)
===================================================================
--- lib/db.c    2018-03-28 15:25:46 +0900 (307491d96)
+++ lib/db.c    2018-03-28 15:26:43 +0900 (4372249e5)
@@ -262,21 +262,17 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
         goto exit;
       }
     }
-    if (!grn_db_config_create(ctx, s, path, "[db][create]")) {
-      goto exit;
-    }
-    grn_ctx_use(ctx, (grn_obj *)s);
-    grn_db_init_builtin_types(ctx);
+  }
+
+  if (!grn_db_config_create(ctx, s, path, "[db][create]")) {
+    goto exit;
+  }
+  grn_ctx_use(ctx, (grn_obj *)s);
+  grn_db_init_builtin_types(ctx);
+  if (path) {
     grn_obj_flush(ctx, (grn_obj *)s);
-    GRN_API_RETURN((grn_obj *)s);
-  } else {
-    if (!grn_db_config_create(ctx, s, NULL, "[db][create]")) {
-      goto exit;
-    }
-    grn_ctx_use(ctx, (grn_obj *)s);
-    grn_db_init_builtin_types(ctx);
-    GRN_API_RETURN((grn_obj *)s);
   }
+  GRN_API_RETURN((grn_obj *)s);
 
 exit:
   if (s) {
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20180328/9c9c59dc/attachment.htm 



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