[Groonga-commit] groonga/groonga at 139c4a5 [master] windows: remove custom event source name support

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 27 10:56:43 JST 2015


Kouhei Sutou	2015-07-27 10:56:43 +0900 (Mon, 27 Jul 2015)

  New Revision: 139c4a590c501f63e90567c4548edf43fefb2c60
  https://github.com/groonga/groonga/commit/139c4a590c501f63e90567c4548edf43fefb2c60

  Message:
    windows: remove custom event source name support
    
    Because we should use "Windows Event Log"(*1) API rather than "Event
    Logging"(*2) API. "Windows Event Log" API is the replacement API for
    "Event Logging" API. Event source name is for "Event Logging" API.
    
    (*1) https://msdn.microsoft.com/en-us/library/windows/desktop/aa385780%28v=vs.85%29.aspx
    (*2) https://msdn.microsoft.com/en-us/library/windows/desktop/aa363652%28v=vs.85%29.aspx

  Modified files:
    include/groonga/windows_event_logger.h
    lib/windows_event_logger.c
    src/groonga.c

  Modified: include/groonga/windows_event_logger.h (+0 -3)
===================================================================
--- include/groonga/windows_event_logger.h    2015-07-26 19:02:51 +0900 (ec53125)
+++ include/groonga/windows_event_logger.h    2015-07-27 10:56:43 +0900 (1bc5710)
@@ -23,9 +23,6 @@
 extern "C" {
 #endif
 
-GRN_API const char *grn_windows_event_logger_get_source_name(void);
-GRN_API void grn_windows_event_logger_set_source_name(const char *name);
-
 GRN_API grn_rc grn_windows_event_logger_set(grn_ctx *ctx);
 
 #ifdef __cplusplus

  Modified: lib/windows_event_logger.c (+1 -30)
===================================================================
--- lib/windows_event_logger.c    2015-07-26 19:02:51 +0900 (f80fc1b)
+++ lib/windows_event_logger.c    2015-07-27 10:56:43 +0900 (a0c7b27)
@@ -22,35 +22,11 @@
 
 #include <string.h>
 
-static char *windows_event_source_name = NULL;
-
 #ifdef WIN32
 typedef struct _grn_windows_event_logger_data {
   HANDLE event_log;
 } grn_windows_event_logger_data;
-#endif /* WIN32 */
-
-const char *
-grn_windows_event_logger_get_source_name(void)
-{
-  return windows_event_source_name;
-}
-
-void
-grn_windows_event_logger_set_source_name(const char *name)
-{
-  if (windows_event_source_name) {
-    free(windows_event_source_name);
-  }
 
-  if (name) {
-    windows_event_source_name = grn_strdup_raw(name);
-  } else {
-    windows_event_source_name = NULL;
-  }
-}
-
-#ifdef WIN32
 static void
 windows_event_logger_log(grn_ctx *ctx, grn_log_level level,
                          const char *timestamp, const char *title,
@@ -186,7 +162,7 @@ grn_windows_event_logger_set(grn_ctx *ctx)
   grn_rc rc;
   grn_logger windows_event_logger;
   grn_windows_event_logger_data *data;
-  const char *source_name;
+  const char *source_name = "Groonga";
   if (ctx) {
     GRN_API_ENTER;
   }
@@ -202,11 +178,6 @@ grn_windows_event_logger_set(grn_ctx *ctx)
     }
   }
 
-  if (windows_event_source_name) {
-    source_name = windows_event_source_name;
-  } else {
-    source_name = "Groonga";
-  }
   data->event_log = RegisterEventSourceA(NULL, source_name);
   if (!data->event_log) {
     free(data);

  Modified: src/groonga.c (+0 -9)
===================================================================
--- src/groonga.c    2015-07-26 19:02:51 +0900 (551b104)
+++ src/groonga.c    2015-07-27 10:56:43 +0900 (2d4ac33)
@@ -2669,9 +2669,6 @@ show_usage(FILE *output)
 #ifdef WIN32
           "      --use-windows-event-log:\n"
           "                           report logs as Windows events\n"
-          "      --windows-event-source-name <name>:\n"
-          "                           specify event source name\n"
-          "                           (default: Groonga)\n"
 #endif /* WIN32 */
           "      --query-log-path <path>:\n"
           "                           specify query log path\n"
@@ -2735,7 +2732,6 @@ main(int argc, char **argv)
   const char *input_fd_arg = NULL;
   const char *output_fd_arg = NULL;
   const char *working_directory_arg = NULL;
-  const char *windows_event_source_name_arg = NULL;
   const char *config_path = NULL;
   int exit_code = EXIT_SUCCESS;
   int i;
@@ -2773,7 +2769,6 @@ main(int argc, char **argv)
     {'\0', "working-directory", NULL, 0, GETOPT_OP_NONE},
     {'\0', "use-windows-event-log", NULL,
      FLAG_USE_WINDOWS_EVENT_LOG, GETOPT_OP_ON},
-    {'\0', "windows-event-source-name", NULL, 0, GETOPT_OP_NONE},
     {'\0', NULL, NULL, 0, 0}
   };
   opts[0].arg = &port_arg;
@@ -2797,7 +2792,6 @@ main(int argc, char **argv)
   opts[25].arg = &input_fd_arg;
   opts[26].arg = &output_fd_arg;
   opts[27].arg = &working_directory_arg;
-  opts[29].arg = &windows_event_source_name_arg;
 
   reset_ready_notify_pipe();
 
@@ -2954,9 +2948,6 @@ main(int argc, char **argv)
 #endif /* WIN32 */
 
   if (use_windows_event_log) {
-    if (windows_event_source_name_arg) {
-      grn_windows_event_logger_set_source_name(windows_event_source_name_arg);
-    }
     grn_windows_event_logger_set(NULL);
   }
 
-------------- next part --------------
HTML����������������������������...
Download 



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