[Groonga-commit] groonga/groonga at d4c748d [master] groonga-httpd: use if block instead of guard clause

Back to archive index

Kouhei Sutou null+****@clear*****
Tue Sep 24 17:02:15 JST 2013


Kouhei Sutou	2013-09-24 17:02:15 +0900 (Tue, 24 Sep 2013)

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

  Message:
    groonga-httpd: use if block instead of guard clause
    
    Because auto database create fallback is not normal case. Top level
    should have normal cases by guard clause.

  Modified files:
    src/httpd/nginx-module/ngx_http_groonga_module.c

  Modified: src/httpd/nginx-module/ngx_http_groonga_module.c (+3 -4)
===================================================================
--- src/httpd/nginx-module/ngx_http_groonga_module.c    2013-09-24 16:57:16 +0900 (d81cf00)
+++ src/httpd/nginx-module/ngx_http_groonga_module.c    2013-09-24 17:02:15 +0900 (2bb7806)
@@ -1123,10 +1123,7 @@ ngx_http_groonga_open_database_callback(ngx_http_groonga_loc_conf_t *location_co
   }
 
   grn_db_open(context, location_conf->database_path_cstr);
-  if (context->rc == GRN_SUCCESS) {
-    return;
-  }
-
+  if (context->rc != GRN_SUCCESS) {
   if (location_conf->database_auto_create) {
     ngx_http_groonga_create_database(location_conf, data);
   } else {
@@ -1134,6 +1131,8 @@ ngx_http_groonga_open_database_callback(ngx_http_groonga_loc_conf_t *location_co
                   "failed to open groonga database: %s",
                   context->errbuf);
     data->rc = NGX_ERROR;
+    return;
+  }
   }
 }
 
-------------- next part --------------
HTML����������������������������...
Download 



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