[Xfce4-commits] <thunar:master> Fix the compiler warnings in tdb.

Nick Schermer noreply at xfce.org
Tue Sep 29 12:50:01 CEST 2009


Updating branch refs/heads/master
         to 5c38ecbcf4f13e9921214580f1d514bcc5c21e0a (commit)
       from 1775eff4f5182a11c551fbe708b2a8f9a7e7fe37 (commit)

commit 5c38ecbcf4f13e9921214580f1d514bcc5c21e0a
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Sep 29 12:48:21 2009 +0200

    Fix the compiler warnings in tdb.

 tdb/tdb.c     |    2 +-
 tdb/tdb.h     |    2 ++
 tdb/tdbtool.c |   30 +++++++++++++++---------------
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tdb/tdb.c b/tdb/tdb.c
index fcef5b6..23d0bf0 100644
--- a/tdb/tdb.c
+++ b/tdb/tdb.c
@@ -745,7 +745,7 @@ update:
 static int expand_file(TDB_CONTEXT *tdb, tdb_off size, tdb_off addition)
 {
 	char buf[1024];
-#if HAVE_FTRUNCATE_EXTEND
+#ifdef HAVE_FTRUNCATE_EXTEND
 	if (ftruncate(tdb->fd, size+addition) != 0) {
 		TDB_LOG((tdb, 0, "expand_file ftruncate to %d failed (%s)\n", 
 			   size+addition, strerror(errno)));
diff --git a/tdb/tdb.h b/tdb/tdb.h
index 84b83dc..5567d4a 100644
--- a/tdb/tdb.h
+++ b/tdb/tdb.h
@@ -147,6 +147,8 @@ void tdb_unlockall(TDB_CONTEXT *tdb);
 void tdb_set_lock_alarm(sig_atomic_t *palarm);
 int tdb_chainlock(TDB_CONTEXT *tdb, TDB_DATA key);
 int tdb_chainunlock(TDB_CONTEXT *tdb, TDB_DATA key);
+int tdb_chainlock_read(TDB_CONTEXT *tdb, TDB_DATA key);
+int tdb_chainunlock_read(TDB_CONTEXT *tdb, TDB_DATA key);
 
 /* Debug functions. Not used in production. */
 void tdb_dump_all(TDB_CONTEXT *tdb);
diff --git a/tdb/tdbtool.c b/tdb/tdbtool.c
index 87d43c4..857a140 100644
--- a/tdb/tdbtool.c
+++ b/tdb/tdbtool.c
@@ -129,7 +129,7 @@ static char *get_token(int startover)
   return start;
 }
 
-static int open_dump_file()
+static int open_dump_file(void)
 {
   int retval = 0;
   char *tok = get_token(0);
@@ -148,7 +148,7 @@ static int open_dump_file()
     return(retval);
 }
 
-static void close_dump_file()
+static void close_dump_file(void)
 {
   if(pDumpFile != NULL && pDumpFile != stdout) {
     fclose(pDumpFile);
@@ -340,7 +340,7 @@ static void delete_tdb(void)
   }
 }
 
-static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int print_rec(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   fprintf(pDumpFile,"\nkey %u bytes\n", (unsigned) key.dsize);
   print_asc((unsigned char*)key.dptr, key.dsize);
@@ -349,7 +349,7 @@ static int print_rec(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
   return 0;
 }
 
-static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int print_key(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   print_asc((unsigned char*)key.dptr, key.dsize);
   printf("\n");
@@ -358,7 +358,7 @@ static int print_key(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
 
 static int total_bytes;
 
-static int traverse_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state)
+static int traverse_fn(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf, void *state)
 {
   total_bytes += dbuf.dsize;
   return 0;
@@ -387,34 +387,34 @@ static char *tdb_getline(char *prompt)
   return p?line:NULL;
 }
 
-static int do_delete_fn(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf,
+static int do_delete_fn(TDB_CONTEXT *context, TDB_DATA key, TDB_DATA dbuf,
                      void *state)
 {
-    return tdb_delete(tdb, key);
+    return tdb_delete(context, key);
 }
 
-static void first_record(TDB_CONTEXT *tdb, TDB_DATA *pkey)
+static void first_record(TDB_CONTEXT *context, TDB_DATA *pkey)
 {
   TDB_DATA dbuf;
-  *pkey = tdb_firstkey(tdb);
+  *pkey = tdb_firstkey(context);
   
-  dbuf = tdb_fetch(tdb, *pkey);
+  dbuf = tdb_fetch(context, *pkey);
   if (!dbuf.dptr) terror("fetch failed");
   /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */
-  print_rec(tdb, *pkey, dbuf, NULL);
+  print_rec(context, *pkey, dbuf, NULL);
 }
 
-static void next_record(TDB_CONTEXT *tdb, TDB_DATA *pkey)
+static void next_record(TDB_CONTEXT *context, TDB_DATA *pkey)
 {
   TDB_DATA dbuf;
-  *pkey = tdb_nextkey(tdb, *pkey);
+  *pkey = tdb_nextkey(context, *pkey);
   
-  dbuf = tdb_fetch(tdb, *pkey);
+  dbuf = tdb_fetch(context, *pkey);
   if (!dbuf.dptr) 
     terror("fetch failed");
   else
     /* printf("%s : %*.*s\n", k, (int)dbuf.dsize, (int)dbuf.dsize, dbuf.dptr); */
-    print_rec(tdb, *pkey, dbuf, NULL);
+    print_rec(context, *pkey, dbuf, NULL);
 }
 
 int main(int argc, char *argv[])



More information about the Xfce4-commits mailing list