[Groonga-commit] groonga/groonga at 215df0f [master] Clear current logger on finalize

Back to archive index

Kouhei Sutou null+****@clear*****
Wed Jan 4 13:35:49 JST 2017


Kouhei Sutou	2017-01-04 13:35:49 +0900 (Wed, 04 Jan 2017)

  New Revision: 215df0fe8ad9a628cf3ac5b9d43b2aa57d615fa0
  https://github.com/groonga/groonga/commit/215df0fe8ad9a628cf3ac5b9d43b2aa57d615fa0

  Message:
    Clear current logger on finalize

  Modified files:
    lib/logger.c

  Modified: lib/logger.c (+27 -15)
===================================================================
--- lib/logger.c    2017-01-04 13:35:29 +0900 (979e1b4)
+++ lib/logger.c    2017-01-04 13:35:49 +0900 (d294d64)
@@ -218,14 +218,16 @@ static grn_logger default_logger = {
   default_logger_fin
 };
 
-static grn_logger current_logger = {
-  GRN_LOG_DEFAULT_LEVEL,
-  GRN_LOG_TIME|GRN_LOG_MESSAGE,
-  NULL,
-  NULL,
-  NULL,
-  NULL
-};
+#define INITIAL_LOGGER {                        \
+  GRN_LOG_DEFAULT_LEVEL,                        \
+  GRN_LOG_TIME|GRN_LOG_MESSAGE,                 \
+  NULL,                                         \
+  NULL,                                         \
+  NULL,                                         \
+  NULL                                          \
+}
+
+static grn_logger current_logger = INITIAL_LOGGER;
 
 void
 grn_default_logger_set_max_level(grn_log_level max_level)
@@ -303,6 +305,10 @@ current_logger_fin(grn_ctx *ctx)
   if (current_logger.fin) {
     current_logger.fin(ctx, current_logger.user_data);
   }
+  {
+    grn_logger initial_logger = INITIAL_LOGGER;
+    current_logger = initial_logger;
+  }
 }
 
 static void
@@ -529,13 +535,15 @@ static grn_query_logger default_query_logger = {
   default_query_logger_fin
 };
 
-static grn_query_logger current_query_logger = {
-  GRN_QUERY_LOG_DEFAULT,
-  NULL,
-  NULL,
-  NULL,
-  NULL
-};
+#define INITIAL_QUERY_LOGGER {                  \
+  GRN_QUERY_LOG_DEFAULT,                        \
+  NULL,                                         \
+  NULL,                                         \
+  NULL,                                         \
+  NULL                                          \
+}
+
+static grn_query_logger current_query_logger = INITIAL_QUERY_LOGGER;
 
 void
 grn_default_query_logger_set_flags(unsigned int flags)
@@ -598,6 +606,10 @@ current_query_logger_fin(grn_ctx *ctx)
   if (current_query_logger.fin) {
     current_query_logger.fin(ctx, current_query_logger.user_data);
   }
+  {
+    grn_query_logger initial_query_logger = INITIAL_QUERY_LOGGER;
+    current_query_logger = initial_query_logger;
+  }
 }
 
 grn_rc
-------------- next part --------------
HTML����������������������������...
Download 



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