[Groonga-commit] groonga/groonga at 9cc57fa [master] Fix a bug that the default --cache-limit value is 0 in --help

Back to archive index

Kouhei Sutou null+****@clear*****
Sat Aug 3 21:44:51 JST 2013


Kouhei Sutou	2013-08-03 21:44:51 +0900 (Sat, 03 Aug 2013)

  New Revision: 9cc57fa436fae82b939f00676c376089cd1337ca
  https://github.com/groonga/groonga/commit/9cc57fa436fae82b939f00676c376089cd1337ca

  Message:
    Fix a bug that the default --cache-limit value is 0 in --help
    
    The correct default --cache-limit value is 100.

  Modified files:
    lib/ctx.c
    lib/ctx.h
    src/groonga.c

  Modified: lib/ctx.c (+1 -1)
===================================================================
--- lib/ctx.c    2013-08-03 20:56:18 +0900 (df59dd9)
+++ lib/ctx.c    2013-08-03 21:44:51 +0900 (c93019e)
@@ -2001,7 +2001,7 @@ grn_cache_init(void)
   grn_gcache.hash = grn_hash_create(&grn_gctx, NULL, GRN_TABLE_MAX_KEY_SIZE,
                                     sizeof(grn_cache_entry), GRN_OBJ_KEY_VAR_SIZE);
   MUTEX_INIT(grn_gcache.mutex);
-  grn_gcache.max_nentries = 100;
+  grn_gcache.max_nentries = GRN_CACHE_DEFAULT_MAX_N_ENTRIES;
 }
 
 uint32_t *

  Modified: lib/ctx.h (+2 -0)
===================================================================
--- lib/ctx.h    2013-08-03 20:56:18 +0900 (21fea9b)
+++ lib/ctx.h    2013-08-03 21:44:51 +0900 (819cc59)
@@ -469,6 +469,8 @@ typedef struct {
 
 /**** cache ****/
 
+#define GRN_CACHE_DEFAULT_MAX_N_ENTRIES 100
+
 typedef struct {
   uint32_t nentries;
   uint32_t max_nentries;

  Modified: src/groonga.c (+3 -6)
===================================================================
--- src/groonga.c    2013-08-03 20:56:18 +0900 (6688397)
+++ src/groonga.c    2013-08-03 21:44:51 +0900 (b804a94)
@@ -94,7 +94,6 @@ static grn_encoding encoding;
 static grn_command_version default_command_version;
 static int64_t default_match_escalation_threshold;
 static int log_level;
-static uint32_t cache_limit;
 
 static int
 grn_rc_to_exit_code(grn_rc rc)
@@ -1849,7 +1848,6 @@ static const char * const default_dest = "localhost";
 static const char *default_log_path = "";
 static const char *default_query_log_path = "";
 static const char *default_config_path = "";
-static uint32_t default_cache_limit = 0;
 static const char *default_document_root = "";
 static grn_command_version default_default_command_version =
     GRN_COMMAND_VERSION_DEFAULT;
@@ -1906,8 +1904,6 @@ init_default_settings(void)
     }
   }
 
-  default_cache_limit = *grn_cache_max_nentries();
-
 #ifdef WIN32
   {
     static char win32_default_document_root[PATH_MAX];
@@ -2021,6 +2017,8 @@ show_version(void)
 static void
 show_usage(FILE *output)
 {
+  uint32_t default_cache_limit = GRN_CACHE_DEFAULT_MAX_N_ENTRIES;
+
   fprintf(output,
           "Usage: groonga [options...] [dest]\n"
           "\n"
@@ -2116,6 +2114,7 @@ main(int argc, char **argv)
   const char *config_path = NULL;
   int exit_code = EXIT_SUCCESS;
   int i, mode = mode_alone;
+  uint32_t cache_limit = 0;
   static grn_str_getopt_opt opts[] = {
     {'p', "port", NULL, 0, GETOPT_OP_NONE},
     {'e', "encoding", NULL, 0, GETOPT_OP_NONE},
@@ -2472,8 +2471,6 @@ main(int argc, char **argv)
       return EXIT_FAILURE;
     }
     cache_limit = value;
-  } else {
-    cache_limit = default_cache_limit;
   }
 
 #ifdef GRN_WITH_LIBEDIT
-------------- next part --------------
HTML����������������������������...
Download 



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