[Groonga-commit] groonga/groonga at 612b062 [master] Rename grn_plugin_log() to grn_ctx_logv()

Back to archive index

Kouhei Sutou null+****@clear*****
Thu May 12 15:15:48 JST 2016


Kouhei Sutou	2016-05-12 15:15:48 +0900 (Thu, 12 May 2016)

  New Revision: 612b062ee9c015efe040f7254f88d117d9480e64
  https://github.com/groonga/groonga/commit/612b062ee9c015efe040f7254f88d117d9480e64

  Message:
    Rename grn_plugin_log() to grn_ctx_logv()

  Modified files:
    lib/ctx.c
    lib/grn_ctx.h
    lib/plugin.c

  Modified: lib/ctx.c (+10 -4)
===================================================================
--- lib/ctx.c    2016-05-12 11:59:05 +0900 (3a2ffe8)
+++ lib/ctx.c    2016-05-12 15:15:48 +0900 (2d87b71)
@@ -1494,10 +1494,16 @@ grn_ctx_use(grn_ctx *ctx, grn_obj *db)
 void
 grn_ctx_log(grn_ctx *ctx, const char *fmt, ...)
 {
-  va_list argp;
-  va_start(argp, fmt);
-  grn_vsnprintf(ctx->errbuf, GRN_CTX_MSGSIZE, fmt, argp);
-  va_end(argp);
+  va_list ap;
+  va_start(ap, fmt);
+  grn_ctx_logv(ctx, fmt, ap);
+  va_end(ap);
+}
+
+void
+grn_ctx_logv(grn_ctx *ctx, const char *fmt, va_list ap)
+{
+  grn_vsnprintf(ctx->errbuf, GRN_CTX_MSGSIZE, fmt, ap);
 }
 
 void

  Modified: lib/grn_ctx.h (+1 -0)
===================================================================
--- lib/grn_ctx.h    2016-05-12 11:59:05 +0900 (2ebafb1)
+++ lib/grn_ctx.h    2016-05-12 15:15:48 +0900 (8f794e6)
@@ -428,6 +428,7 @@ extern int grn_lock_timeout;
 extern grn_timeval grn_starttime;
 
 GRN_API void grn_ctx_log(grn_ctx *ctx, const char *fmt, ...) GRN_ATTRIBUTE_PRINTF(2);
+GRN_API void grn_ctx_logv(grn_ctx *ctx, const char *fmt, va_list ap);
 void grn_ctx_loader_clear(grn_ctx *ctx);
 void grn_log_reopen(grn_ctx *ctx);
 

  Modified: lib/plugin.c (+1 -11)
===================================================================
--- lib/plugin.c    2016-05-12 11:59:05 +0900 (1c3fd3e)
+++ lib/plugin.c    2016-05-12 15:15:48 +0900 (0d38592)
@@ -1090,16 +1090,6 @@ grn_plugin_free(grn_ctx *ctx, void *ptr, const char *file, int line,
   grn_free(ctx, ptr, file, line, func);
 }
 
-/*
-  grn_plugin_ctx_log() is a clone of grn_ctx_log() in ctx.c. The only
-  difference is that grn_plugin_ctx_log() uses va_list instead of `...'.
- */
-static void
-grn_plugin_ctx_log(grn_ctx *ctx, const char *format, va_list ap)
-{
-  vsnprintf(ctx->errbuf, GRN_CTX_MSGSIZE, format, ap);
-}
-
 void
 grn_plugin_set_error(grn_ctx *ctx, grn_log_level level, grn_rc error_code,
                      const char *file, int line, const char *func,
@@ -1114,7 +1104,7 @@ grn_plugin_set_error(grn_ctx *ctx, grn_log_level level, grn_rc error_code,
   {
     va_list ap;
     va_start(ap, format);
-    grn_plugin_ctx_log(ctx, format, ap);
+    grn_ctx_logv(ctx, format, ap);
     va_end(ap);
   }
 }
-------------- next part --------------
HTML����������������������������...
Download 



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