r2239: Fixup formatting errors in TDB_LOG calls. Add printf attribute support to
authorJim McDonough <jmcd@samba.org>
Tue, 7 Sep 2004 13:51:03 +0000 (13:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:52:37 +0000 (10:52 -0500)
tdb log functions.

source/tdb/tdb.c
source/tdb/tdb.h

index ac159863bdc50d4251f4e9454ff6d3db7f5ae802..ae4e439c90330cfa1cf6669ec37c7e87dc83a7f4 100644 (file)
@@ -276,7 +276,7 @@ static int tdb_lock(TDB_CONTEXT *tdb, int list, int ltype)
        if (tdb->locked[list+1].count == 0) {
                if (!tdb->read_only && tdb->header.rwlocks) {
                        if (tdb_spinlock(tdb, list, ltype)) {
-                               TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list ltype=%d\n", 
+                               TDB_LOG((tdb, 0, "tdb_lock spinlock failed on list %d ltype=%d\n", 
                                           list, ltype));
                                return -1;
                        }
index c28e10af693d4ad69d58937446f88aa2742d58db..3db676a633f8bb5d7f178b9c0d0f17dabf492c80 100644 (file)
@@ -31,6 +31,9 @@
 extern "C" {
 #endif
 
+#ifndef PRINTF_ATTRIBUTE
+#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
+#endif
 
 /* flags to tdb_store() */
 #define TDB_REPLACE 1
@@ -101,7 +104,7 @@ typedef struct tdb_context {
        struct tdb_context *next; /* all tdbs to avoid multiple opens */
        dev_t device;   /* uniquely identifies this tdb */
        ino_t inode;    /* uniquely identifies this tdb */
-       void (*log_fn)(struct tdb_context *tdb, int level, const char *, ...); /* logging function */
+       void (*log_fn)(struct tdb_context *tdb, int level, const char *, ...) PRINTF_ATTRIBUTE(3,4); /* logging function */
        u32 (*hash_fn)(TDB_DATA *key);
        int open_flags; /* flags used in the open - needed by reopen */
 } TDB_CONTEXT;