[Groonga-commit] groonga/groonga at e8bab62 [master] groonga: initialize line editor only when it's needed

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Mar 5 22:08:46 JST 2015


Kouhei Sutou	2015-03-05 22:08:46 +0900 (Thu, 05 Mar 2015)

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

  Message:
    groonga: initialize line editor only when it's needed

  Modified files:
    src/groonga.c

  Modified: src/groonga.c (+7 -2)
===================================================================
--- src/groonga.c    2015-03-05 21:30:19 +0900 (112e5f3)
+++ src/groonga.c    2015-03-05 22:08:46 +0900 (e9d1f34)
@@ -2618,6 +2618,7 @@ main(int argc, char **argv)
   int i;
   int flags = 0;
   uint32_t cache_limit = 0;
+  grn_bool need_line_editor = GRN_FALSE;
   static grn_str_getopt_opt opts[] = {
     {'p', "port", NULL, 0, GETOPT_OP_NONE},
     {'e', "encoding", NULL, 0, GETOPT_OP_NONE},
@@ -2878,6 +2879,10 @@ main(int argc, char **argv)
     }
   }
 
+  if ((flags & FLAG_MODE_CLIENT) && !batchmode) {
+    need_line_editor = GRN_TRUE;
+  }
+
   if (output_fd_arg) {
     const char * const end = output_fd_arg + strlen(output_fd_arg);
     const char *rest = NULL;
@@ -2979,7 +2984,7 @@ main(int argc, char **argv)
   }
 
 #ifdef GRN_WITH_LIBEDIT
-  if (!batchmode) {
+  if (need_line_editor) {
     line_editor_init(argc, argv);
   }
 #endif
@@ -3016,7 +3021,7 @@ main(int argc, char **argv)
   }
 
 #ifdef GRN_WITH_LIBEDIT
-  if (!batchmode) {
+  if (need_line_editor) {
     line_editor_fin();
   }
 #endif
-------------- next part --------------
HTML����������������������������...
下载 



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