chiark / gitweb /
logging: provide vslilog as well as slilog
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 12 Jun 2011 19:03:33 +0000 (20:03 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sun, 19 Jun 2011 15:38:42 +0000 (16:38 +0100)
In general it is a mistake to provide a varargs function which takes a
format string, but not the corresponding function taking a va_list.

We implement slilog in terms of vslilog in the obvious way.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
secnet.h
util.c

index ede3ffcf376e6f479404f88ae2bf1b554df5b8e0..2b913d9854802b9cd15135e45ebc0e039bc10d2d 100644 (file)
--- a/secnet.h
+++ b/secnet.h
@@ -324,9 +324,11 @@ struct log_if {
     log_msg_fn *log;
     log_vmsg_fn *vlog;
 };
-/* (convenience function, defined in util.c) */
+/* (convenience functions, defined in util.c) */
 extern void slilog(struct log_if *lf, int class, const char *message, ...)
 FORMAT(printf,3,4);
+extern void vslilog(struct log_if *lf, int class, const char *message, va_list)
+FORMAT(printf,3,0);
 
 /* SITE interface */
 
diff --git a/util.c b/util.c
index 9a009dca911d79f1feafe5c2f4c8c144bb3e667c..997979ac93b4e99b498602077f72519755eb68c6 100644 (file)
--- a/util.c
+++ b/util.c
@@ -198,12 +198,17 @@ bool_t remove_hook(uint32_t phase, hook_fn *fn, void *state)
     return False;
 }
 
+void vslilog(struct log_if *lf, int priority, const char *message, va_list ap)
+{
+    lf->vlog(lf->st,priority,message,ap);
+}
+
 void slilog(struct log_if *lf, int priority, const char *message, ...)
 {
     va_list ap;
     
     va_start(ap,message);
-    lf->vlog(lf->st,priority,message,ap);
+    vslilog(lf,priority,message,ap);
     va_end(ap);
 }