gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r5340 - in GNUnet/src: applications/datastore applications/


From: gnunet
Subject: [GNUnet-SVN] r5340 - in GNUnet/src: applications/datastore applications/fs/ecrs applications/fs/lib applications/fs/module applications/session applications/sqstore_mysql applications/sqstore_sqlite applications/transport include server transports
Date: Sun, 22 Jul 2007 02:25:49 -0600 (MDT)

Author: grothoff
Date: 2007-07-22 02:25:48 -0600 (Sun, 22 Jul 2007)
New Revision: 5340

Modified:
   GNUnet/src/applications/datastore/datastore.c
   GNUnet/src/applications/datastore/prefetch.c
   GNUnet/src/applications/fs/ecrs/download.c
   GNUnet/src/applications/fs/ecrs/upload.c
   GNUnet/src/applications/fs/lib/fslib.c
   GNUnet/src/applications/fs/module/dht_push.c
   GNUnet/src/applications/fs/module/fs.c
   GNUnet/src/applications/fs/module/ondemand.c
   GNUnet/src/applications/session/connect.c
   GNUnet/src/applications/sqstore_mysql/mysql.c
   GNUnet/src/applications/sqstore_mysql/mysqltest.c
   GNUnet/src/applications/sqstore_mysql/mysqltest2.c
   GNUnet/src/applications/sqstore_mysql/mysqltest3.c
   GNUnet/src/applications/sqstore_sqlite/sqlite.c
   GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
   GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
   GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c
   GNUnet/src/applications/transport/check.c
   GNUnet/src/applications/transport/transport.c
   GNUnet/src/include/gnunet_datastore_service.h
   GNUnet/src/server/connection.c
   GNUnet/src/transports/tcp_helper.c
Log:
compile-format

Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c       2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/datastore/datastore.c       2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -114,16 +114,16 @@
 
 static int
 deleteCB (const HashCode512 * key,
-         const Datastore_Value * value, void *closure,
-         unsigned long long uid)
+          const Datastore_Value * value, void *closure,
+          unsigned long long uid)
 {
-  const Datastore_Value * have = closure;
+  const Datastore_Value *have = closure;
   if (have == NULL)
     return NO;
-  if  ( (value->size == have->size) &&
-       (0 == memcmp(&have[1],
-                    &value[1],
-                    ntohl(value->size) - sizeof(Datastore_Value))))
+  if ((value->size == have->size) &&
+      (0 == memcmp (&have[1],
+                    &value[1],
+                    ntohl (value->size) - sizeof (Datastore_Value))))
     return NO;
   return OK;
 }
@@ -147,7 +147,7 @@
               &enc, __FILE__, __LINE__);
       return 0;
     }
-  ok = sq->get (query, ntohl(value->type), &deleteCB, (void*) value);
+  ok = sq->get (query, ntohl (value->type), &deleteCB, (void *) value);
   while (ok-- > 0)
     {
       makeUnavailable (query);  /* update filter! */
@@ -203,7 +203,7 @@
 
 typedef struct
 {
-  int exists; 
+  int exists;
   const Datastore_Value *value;
   unsigned long long uid;
   unsigned long long expiration;
@@ -211,8 +211,7 @@
 
 static int
 checkExists (const HashCode512 * key,
-             const Datastore_Value * value, void *cls,
-            unsigned long long uid)
+             const Datastore_Value * value, void *cls, unsigned long long uid)
 {
   CE *ce = cls;
 
@@ -222,7 +221,7 @@
                     ntohl (value->size) - sizeof (Datastore_Value))))
     return OK;                  /* found another value, but different content! 
*/
   ce->uid = uid;
-  ce->expiration = ntohll(value->expirationTime);
+  ce->expiration = ntohll (value->expirationTime);
   ce->exists = YES;
   return SYSERR;                /* abort iteration! */
 }
@@ -253,8 +252,7 @@
   if (cls.exists)
     {
       if ((ntohl (value->prio) == 0) &&
-          (ntohll (value->expirationTime) <=
-           cls.expiration))
+          (ntohll (value->expirationTime) <= cls.expiration))
         {
           return OK;
         }
@@ -295,7 +293,7 @@
 static int
 freeSpaceExpired (const HashCode512 * key,
                   const Datastore_Value * value, void *closure,
-                 unsigned long long uid)
+                  unsigned long long uid)
 {
   if ((available > 0) && (available >= MIN_FREE))
     return SYSERR;
@@ -308,7 +306,7 @@
 static int
 freeSpaceLow (const HashCode512 * key,
               const Datastore_Value * value, void *closure,
-             unsigned long long uid)
+              unsigned long long uid)
 {
   if ((available > 0) && (available >= MIN_FREE))
     return SYSERR;
@@ -459,7 +457,7 @@
 static int
 filterAddAll (const HashCode512 * key,
               const Datastore_Value * value, void *closure,
-             unsigned long long uid)
+              unsigned long long uid)
 {
   makeAvailable (key);
   return OK;

Modified: GNUnet/src/applications/datastore/prefetch.c
===================================================================
--- GNUnet/src/applications/datastore/prefetch.c        2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/datastore/prefetch.c        2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -65,8 +65,7 @@
 
 static int
 acquire (const HashCode512 * key,
-         const Datastore_Value * value, void *closure,
-        unsigned long long uid)
+         const Datastore_Value * value, void *closure, unsigned long long uid)
 {
   if (doneSignal)
     return SYSERR;

Modified: GNUnet/src/applications/fs/ecrs/download.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/download.c  2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/fs/ecrs/download.c  2007-07-22 08:25:48 UTC (rev 
5340)
@@ -962,8 +962,7 @@
  */
 static int
 nodeReceive (const HashCode512 * query,
-             const Datastore_Value * reply, void *cls,
-            unsigned long long uid)
+             const Datastore_Value * reply, void *cls, unsigned long long uid)
 {
   NodeClosure *node = cls;
   struct GE_Context *ectx = node->ctx->rm->ectx;

Modified: GNUnet/src/applications/fs/ecrs/upload.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/upload.c    2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/fs/ecrs/upload.c    2007-07-22 08:25:48 UTC (rev 
5340)
@@ -328,7 +328,7 @@
         }
       if (OK != pushBlock (sock, &mchk, 0,      /* dblocks are on level 0 */
                            iblocks, priority, expirationTime))
-          goto FAILURE;
+        goto FAILURE;
     }
   if (tt != NULL)
     if (OK != tt (ttClosure))

Modified: GNUnet/src/applications/fs/lib/fslib.c
===================================================================
--- GNUnet/src/applications/fs/lib/fslib.c      2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/fs/lib/fslib.c      2007-07-22 08:25:48 UTC (rev 
5340)
@@ -129,8 +129,7 @@
                                                                value,
                                                                ctx->
                                                                handles[i]->
-                                                               closure,
-                                                              0))
+                                                               closure, 0))
                         {
                           ctx->handles[i]->callback = NULL;
                         }

Modified: GNUnet/src/applications/fs/module/dht_push.c
===================================================================
--- GNUnet/src/applications/fs/module/dht_push.c        2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/fs/module/dht_push.c        2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -76,7 +76,7 @@
 static int
 push_callback (const HashCode512 * key,
                const Datastore_Value * value, void *closure,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   cron_t delay;
 

Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c      2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/fs/module/fs.c      2007-07-22 08:25:48 UTC (rev 
5340)
@@ -513,7 +513,7 @@
 static int
 completeValue (const HashCode512 * key,
                const Datastore_Value * value, void *closure,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 
@@ -709,7 +709,7 @@
 static int
 gapGetConverter (const HashCode512 * key,
                  const Datastore_Value * invalue, void *cls,
-                unsigned long long uid)
+                 unsigned long long uid)
 {
   GGC *ggc = (GGC *) cls;
   GapWrapper *gw;

Modified: GNUnet/src/applications/fs/module/ondemand.c
===================================================================
--- GNUnet/src/applications/fs/module/ondemand.c        2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/fs/module/ondemand.c        2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -98,7 +98,7 @@
 static int
 checkPresent (const HashCode512 * key,
               const Datastore_Value * value, void *closure,
-             unsigned long long uid)
+              unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 
@@ -534,7 +534,7 @@
 static int
 completeValue (const HashCode512 * key,
                const Datastore_Value * value, void *closure,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   Datastore_Value *comp = closure;
 

Modified: GNUnet/src/applications/session/connect.c
===================================================================
--- GNUnet/src/applications/session/connect.c   2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/session/connect.c   2007-07-22 08:25:48 UTC (rev 
5340)
@@ -435,8 +435,8 @@
     return SYSERR;
   hash2enc (&receiver->hashPubKey, &enc);
   /* then try to connect on the transport level */
-  if ( (tsession == NULL)
-       || (transport->associate (tsession, __FILE__) == SYSERR))
+  if ((tsession == NULL)
+      || (transport->associate (tsession, __FILE__) == SYSERR))
     tsession = transport->connectFreely (receiver, YES, __FILE__);
   if (tsession == NULL)
     {

Modified: GNUnet/src/applications/sqstore_mysql/mysql.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_mysql/mysql.c       2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -182,62 +182,62 @@
 
   /* stuff dealing with gn072 table */
 #define SELECT_VALUE "SELECT value FROM gn072 WHERE vkey=?"
-  MYSQL_STMT * select_value;
+  MYSQL_STMT *select_value;
 
 #define DELETE_VALUE "DELETE FROM gn072 WHERE vkey=?"
-  MYSQL_STMT * delete_value;
+  MYSQL_STMT *delete_value;
 
 #define INSERT_VALUE "INSERT INTO gn072 (value) VALUES (?)"
-  MYSQL_STMT * insert_value;
+  MYSQL_STMT *insert_value;
 
   /* stuff dealing with gn071 table */
 #define INSERT_ENTRY "INSERT INTO gn071 
(size,type,prio,anonLevel,expire,hash,vkey) VALUES (?,?,?,?,?,?,?)"
-  MYSQL_STMT * insert_entry;
+  MYSQL_STMT *insert_entry;
 
 #define DELETE_ENTRY_BY_VKEY "DELETE FROM gn071 WHERE vkey=?"
-  MYSQL_STMT * delete_entry_by_vkey;
+  MYSQL_STMT *delete_entry_by_vkey;
 
 #define SELECT_ENTRY_BY_HASH "SELECT * FROM gn071 WHERE hash=? AND vkey > ? 
ORDER BY vkey ASC LIMIT 1"
-  MYSQL_STMT * select_entry_by_hash;
+  MYSQL_STMT *select_entry_by_hash;
 
 #define SELECT_ENTRY_BY_HASH_AND_TYPE "SELECT * FROM gn071 WHERE hash=? AND 
vkey > ? AND type=? ORDER BY vkey ASC LIMIT 1"
-  MYSQL_STMT * select_entry_by_hash_and_type;
+  MYSQL_STMT *select_entry_by_hash_and_type;
 
 #define COUNT_ENTRY_BY_HASH "SELECT count(*) FROM gn071 WHERE hash=?"
-  MYSQL_STMT * count_entry_by_hash;
+  MYSQL_STMT *count_entry_by_hash;
 
 #define COUNT_ENTRY_BY_HASH_AND_TYPE "SELECT count(*) FROM gn071 WHERE hash=? 
AND type=?"
-  MYSQL_STMT * count_entry_by_hash_and_type;
+  MYSQL_STMT *count_entry_by_hash_and_type;
 
 #define UPDATE_ENTRY "UPDATE gn071 SET 
prio=prio+?,expire=IF(expire>=?,expire,?) WHERE vkey=?"
-  MYSQL_STMT * update_entry;
+  MYSQL_STMT *update_entry;
 
 
 
 #define SELECT_IT_LOW_PRIORITY "SELECT * FROM gn071 WHERE ( (prio = ? AND vkey 
> ?) OR (prio > ? AND vkey != ?) )"\
                                "ORDER BY prio ASC,vkey ASC LIMIT 1"
-  MYSQL_STMT * ilow;
+  MYSQL_STMT *ilow;
 
 #define SELECT_IT_NON_ANONYMOUS "SELECT * FROM gn071 WHERE ( (prio = ? AND 
vkey < ?) OR (prio < ? AND vkey != ?) ) "\
                                 "AND anonLevel=0 AND type != 0xFFFFFFFF "\
                                 "ORDER BY prio DESC,vkey DESC LIMIT 1"
-  MYSQL_STMT * inon;
+  MYSQL_STMT *inon;
 
 #define SELECT_IT_EXPIRATION_TIME "SELECT * FROM gn071 WHERE ( (expire = ? AND 
vkey > ?) OR (expire > ? AND vkey != ?) ) "\
                                   "ORDER BY expire ASC,vkey ASC LIMIT 1"
-  MYSQL_STMT * iexp;
+  MYSQL_STMT *iexp;
 
 #define SELECT_IT_MIGRATION_ORDER "SELECT * FROM gn071 WHERE ( (expire = ? AND 
vkey < ?) OR (expire < ? AND vkey != ?) ) "\
                                   "AND expire > ? AND type!=3 "\
                                   "ORDER BY expire DESC,vkey DESC LIMIT 1"
-  MYSQL_STMT * imig;
+  MYSQL_STMT *imig;
 
 } mysqlHandle;
 
 
 #define SELECT_SIZE "SELECT sum(size) FROM gn071"
 
-static mysqlHandle * dbh;
+static mysqlHandle *dbh;
 
 /**
  * Close the database connection.
@@ -248,20 +248,20 @@
 #define PEND(h) if (h != NULL) { mysql_stmt_close(h); h = NULL; } else {}
   if (dbh->dbf == NULL)
     return SYSERR;
-  PEND(dbh->select_value);
-  PEND(dbh->delete_value);
-  PEND(dbh->insert_value);
-  PEND(dbh->insert_entry);
-  PEND(dbh->delete_entry_by_vkey);
-  PEND(dbh->select_entry_by_hash);
-  PEND(dbh->select_entry_by_hash_and_type);
-  PEND(dbh->count_entry_by_hash);
-  PEND(dbh->count_entry_by_hash_and_type);
-  PEND(dbh->update_entry);
-  PEND(dbh->ilow);
-  PEND(dbh->inon);
-  PEND(dbh->iexp);
-  PEND(dbh->imig);
+  PEND (dbh->select_value);
+  PEND (dbh->delete_value);
+  PEND (dbh->insert_value);
+  PEND (dbh->insert_entry);
+  PEND (dbh->delete_entry_by_vkey);
+  PEND (dbh->select_entry_by_hash);
+  PEND (dbh->select_entry_by_hash_and_type);
+  PEND (dbh->count_entry_by_hash);
+  PEND (dbh->count_entry_by_hash_and_type);
+  PEND (dbh->update_entry);
+  PEND (dbh->ilow);
+  PEND (dbh->inon);
+  PEND (dbh->iexp);
+  PEND (dbh->imig);
   mysql_close (dbh->dbf);
   dbh->dbf = NULL;
   dbh->valid = NO;
@@ -303,72 +303,75 @@
   if (mysql_error (dbh->dbf)[0])
     {
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_real_connect", dbh);
-      iclose();
+      iclose ();
       return SYSERR;
     }
   mysql_query (dbh->dbf,
-              "SET SESSION net_read_timeout=60, SESSION net_write_timeout=60");
+               "SET SESSION net_read_timeout=60, SESSION 
net_write_timeout=60");
   if (mysql_error (dbh->dbf)[0])
     {
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
-      iclose();
+      iclose ();
       return SYSERR;
     }
   /* MySQL 5.0.46 fixes a bug in MyISAM (presumably); 
      earlier versions have issues with INDEX over BINARY data,
      which is why we need to use InnoDB for those
      (even though MyISAM would be faster) */
-  if (50046 <= mysql_get_server_version(dbh->dbf)) {
-    /* MySQL 5.0.46 fixes bug in MyISAM */
-    mysql_query (dbh->dbf,
-                "CREATE TABLE IF NOT EXISTS gn071 ("
-                " size INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " type INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
-                " hash BINARY(64) NOT NULL DEFAULT '',"
-                " vkey BIGINT UNSIGNED NOT NULL DEFAULT 0,"
-                " INDEX (hash(64))," 
-                " INDEX (prio,vkey),"
-                " INDEX (expire,vkey,type),"
-                " INDEX (anonLevel,prio,vkey,type)" ") ENGINE=MyISAM");
-  } else {
-    mysql_query (dbh->dbf,
-                "CREATE TABLE IF NOT EXISTS gn071 ("
-                " size INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " type INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
-                " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
-                " hash BINARY(64) NOT NULL DEFAULT '',"
-                " vkey BIGINT UNSIGNED NOT NULL DEFAULT 0,"
-                " INDEX (hash(64))," 
-                " INDEX (prio,vkey),"
-                " INDEX (expire,vkey,type),"
-                " INDEX (anonLevel,prio,vkey,type)" ") ENGINE=InnoDB");
-  }
+  if (50046 <= mysql_get_server_version (dbh->dbf))
+    {
+      /* MySQL 5.0.46 fixes bug in MyISAM */
+      mysql_query (dbh->dbf,
+                   "CREATE TABLE IF NOT EXISTS gn071 ("
+                   " size INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " type INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
+                   " hash BINARY(64) NOT NULL DEFAULT '',"
+                   " vkey BIGINT UNSIGNED NOT NULL DEFAULT 0,"
+                   " INDEX (hash(64)),"
+                   " INDEX (prio,vkey),"
+                   " INDEX (expire,vkey,type),"
+                   " INDEX (anonLevel,prio,vkey,type)" ") ENGINE=MyISAM");
+    }
+  else
+    {
+      mysql_query (dbh->dbf,
+                   "CREATE TABLE IF NOT EXISTS gn071 ("
+                   " size INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " type INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " prio INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " anonLevel INT(11) UNSIGNED NOT NULL DEFAULT 0,"
+                   " expire BIGINT UNSIGNED NOT NULL DEFAULT 0,"
+                   " hash BINARY(64) NOT NULL DEFAULT '',"
+                   " vkey BIGINT UNSIGNED NOT NULL DEFAULT 0,"
+                   " INDEX (hash(64)),"
+                   " INDEX (prio,vkey),"
+                   " INDEX (expire,vkey,type),"
+                   " INDEX (anonLevel,prio,vkey,type)" ") ENGINE=InnoDB");
+    }
   if (mysql_error (dbh->dbf)[0])
     {
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
-      iclose();
+      iclose ();
       return SYSERR;
     }
   mysql_query (dbh->dbf,
-              "CREATE TABLE IF NOT EXISTS gn072 ("
-              " vkey BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,"
-              " value BLOB NOT NULL DEFAULT '') ENGINE=MyISAM");
+               "CREATE TABLE IF NOT EXISTS gn072 ("
+               " vkey BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,"
+               " value BLOB NOT NULL DEFAULT '') ENGINE=MyISAM");
   if (mysql_error (dbh->dbf)[0])
     {
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
-      iclose();
+      iclose ();
       return SYSERR;
     }
   mysql_query (dbh->dbf, "SET AUTOCOMMIT = 1");
   if (mysql_error (dbh->dbf)[0])
     {
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
-      iclose();
+      iclose ();
       return SYSERR;
     }
 #define PINIT(a,b) a = mysql_stmt_init(dbh->dbf); if (a == NULL) { iclose(); 
return SYSERR; } else { \
@@ -376,20 +379,20 @@
       GE_LOG (ectx, GE_ERROR | GE_BULK | GE_USER, \
              _("`%s' failed at %s:%d with error: %s"), "mysql_stmt_prepare", 
__FILE__, __LINE__, \
              mysql_stmt_error (a));  iclose(); return SYSERR; } }
-  PINIT(dbh->select_value, SELECT_VALUE);
-  PINIT(dbh->delete_value, DELETE_VALUE);
-  PINIT(dbh->insert_value, INSERT_VALUE);
-  PINIT(dbh->insert_entry, INSERT_ENTRY);
-  PINIT(dbh->delete_entry_by_vkey, DELETE_ENTRY_BY_VKEY);
-  PINIT(dbh->select_entry_by_hash, SELECT_ENTRY_BY_HASH);
-  PINIT(dbh->select_entry_by_hash_and_type, SELECT_ENTRY_BY_HASH_AND_TYPE);
-  PINIT(dbh->count_entry_by_hash, COUNT_ENTRY_BY_HASH);
-  PINIT(dbh->count_entry_by_hash_and_type, COUNT_ENTRY_BY_HASH_AND_TYPE);
-  PINIT(dbh->update_entry, UPDATE_ENTRY);
-  PINIT(dbh->ilow, SELECT_IT_LOW_PRIORITY);
-  PINIT(dbh->inon, SELECT_IT_NON_ANONYMOUS);
-  PINIT(dbh->iexp, SELECT_IT_EXPIRATION_TIME);
-  PINIT(dbh->imig, SELECT_IT_MIGRATION_ORDER);
+  PINIT (dbh->select_value, SELECT_VALUE);
+  PINIT (dbh->delete_value, DELETE_VALUE);
+  PINIT (dbh->insert_value, INSERT_VALUE);
+  PINIT (dbh->insert_entry, INSERT_ENTRY);
+  PINIT (dbh->delete_entry_by_vkey, DELETE_ENTRY_BY_VKEY);
+  PINIT (dbh->select_entry_by_hash, SELECT_ENTRY_BY_HASH);
+  PINIT (dbh->select_entry_by_hash_and_type, SELECT_ENTRY_BY_HASH_AND_TYPE);
+  PINIT (dbh->count_entry_by_hash, COUNT_ENTRY_BY_HASH);
+  PINIT (dbh->count_entry_by_hash_and_type, COUNT_ENTRY_BY_HASH_AND_TYPE);
+  PINIT (dbh->update_entry, UPDATE_ENTRY);
+  PINIT (dbh->ilow, SELECT_IT_LOW_PRIORITY);
+  PINIT (dbh->inon, SELECT_IT_NON_ANONYMOUS);
+  PINIT (dbh->iexp, SELECT_IT_EXPIRATION_TIME);
+  PINIT (dbh->imig, SELECT_IT_MIGRATION_ORDER);
   dbh->valid = YES;
   return OK;
 }
@@ -408,26 +411,27 @@
  * @param vkey vkey identifying the value to delete
  * @return OK on success, NO if no such value exists, SYSERR on error
  */
-static int delete_value(unsigned long long vkey) {
+static int
+delete_value (unsigned long long vkey)
+{
   MYSQL_BIND qbind[1];
   int ret;
 
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].is_unsigned = YES;
   qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[0].buffer = &vkey;
-  GE_ASSERT (ectx,
-            mysql_stmt_param_count (dbh->delete_value) == 1);
-  if (mysql_stmt_bind_param(dbh->delete_value,
-                           qbind)) {
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_param",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->delete_value));
-    iclose ();
-    return SYSERR;
-  }
+  GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_value) == 1);
+  if (mysql_stmt_bind_param (dbh->delete_value, qbind))
+    {
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_param",
+              __FILE__, __LINE__, mysql_stmt_error (dbh->delete_value));
+      iclose ();
+      return SYSERR;
+    }
   if (mysql_stmt_execute (dbh->delete_value))
     {
       GE_LOG (ectx,
@@ -438,11 +442,11 @@
       iclose ();
       return SYSERR;
     }
-  if (mysql_stmt_affected_rows(dbh->delete_value) == 0)
+  if (mysql_stmt_affected_rows (dbh->delete_value) == 0)
     ret = NO;
   else
     ret = OK;
-  mysql_stmt_reset(dbh->delete_value);
+  mysql_stmt_reset (dbh->delete_value);
   return ret;
 }
 
@@ -454,29 +458,28 @@
  * @param vkey vkey identifying the value henceforth (set)
  * @return OK on success, SYSERR on error
  */
-static int insert_value(const void * value,
-                       unsigned int size,
-                       unsigned long long * vkey) {
+static int
+insert_value (const void *value, unsigned int size, unsigned long long *vkey)
+{
   MYSQL_BIND qbind[1];
   unsigned long length = size;
 
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].buffer_type = MYSQL_TYPE_BLOB;
-  qbind[0].buffer = (void*) value; 
+  qbind[0].buffer = (void *) value;
   qbind[0].buffer_length = size;
   qbind[0].length = &length;
-  GE_ASSERT (ectx,
-            mysql_stmt_param_count (dbh->insert_value) == 1);
-  if (mysql_stmt_bind_param(dbh->insert_value,
-                           qbind)) {
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_param",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->insert_value));
-    iclose ();
-    return SYSERR;
-  }
+  GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_value) == 1);
+  if (mysql_stmt_bind_param (dbh->insert_value, qbind))
+    {
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_param",
+              __FILE__, __LINE__, mysql_stmt_error (dbh->insert_value));
+      iclose ();
+      return SYSERR;
+    }
   if (mysql_stmt_execute (dbh->insert_value))
     {
       GE_LOG (ectx,
@@ -487,8 +490,8 @@
       iclose ();
       return SYSERR;
     }
-  *vkey = (unsigned long long) mysql_stmt_insert_id(dbh->insert_value);
-  mysql_stmt_reset(dbh->insert_value);
+  *vkey = (unsigned long long) mysql_stmt_insert_id (dbh->insert_value);
+  mysql_stmt_reset (dbh->insert_value);
   return OK;
 }
 
@@ -498,41 +501,44 @@
  * @param vkey vkey identifying the entry to delete
  * @return OK on success, NO if no such value exists, SYSERR on error
  */
-static int delete_entry_by_vkey(unsigned long long vkey) {
+static int
+delete_entry_by_vkey (unsigned long long vkey)
+{
   MYSQL_BIND qbind[1];
   int ret;
 
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].is_unsigned = YES;
   qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[0].buffer = &vkey;
-  GE_ASSERT (ectx,
-            mysql_stmt_param_count (dbh->delete_entry_by_vkey) == 1);
-  if (mysql_stmt_bind_param(dbh->delete_entry_by_vkey,
-                           qbind)) {
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_param",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->delete_entry_by_vkey));
-    iclose ();
-    return SYSERR;
-  }
+  GE_ASSERT (ectx, mysql_stmt_param_count (dbh->delete_entry_by_vkey) == 1);
+  if (mysql_stmt_bind_param (dbh->delete_entry_by_vkey, qbind))
+    {
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_param",
+              __FILE__, __LINE__,
+              mysql_stmt_error (dbh->delete_entry_by_vkey));
+      iclose ();
+      return SYSERR;
+    }
   if (mysql_stmt_execute (dbh->delete_entry_by_vkey))
     {
       GE_LOG (ectx,
               GE_ERROR | GE_BULK | GE_USER,
               _("`%s' failed at %s:%d with error: %s\n"),
               "mysql_stmt_execute",
-              __FILE__, __LINE__, mysql_stmt_error 
(dbh->delete_entry_by_vkey));
+              __FILE__, __LINE__,
+              mysql_stmt_error (dbh->delete_entry_by_vkey));
       iclose ();
       return SYSERR;
     }
-  if (mysql_stmt_affected_rows(dbh->delete_entry_by_vkey) == 0)
+  if (mysql_stmt_affected_rows (dbh->delete_entry_by_vkey) == 0)
     ret = NO;
   else
     ret = OK;
-  mysql_stmt_reset(dbh->delete_entry_by_vkey);
+  mysql_stmt_reset (dbh->delete_entry_by_vkey);
   return ret;
 }
 
@@ -557,34 +563,35 @@
   MYSQL_BIND qbind[1];
   MYSQL_BIND rbind[1];
 
-  if ( (result[0].buffer_type != MYSQL_TYPE_LONG) ||
-       (! result[0].is_unsigned) ||
-       (result[1].buffer_type != MYSQL_TYPE_LONG) ||
-       (! result[1].is_unsigned) ||
-       (result[2].buffer_type != MYSQL_TYPE_LONG) ||
-       (! result[2].is_unsigned) ||
-       (result[3].buffer_type != MYSQL_TYPE_LONG) ||
-       (! result[3].is_unsigned) ||
-       (result[4].buffer_type != MYSQL_TYPE_LONGLONG) ||
-       (! result[4].is_unsigned) ||
-       (result[5].buffer_type != MYSQL_TYPE_BLOB) ||
-       (result[5].buffer_length != sizeof(HashCode512)) ||
-       (*result[5].length != sizeof(HashCode512)) ||
-       (result[6].buffer_type != MYSQL_TYPE_LONGLONG) ||
-       (! result[6].is_unsigned) ) {
-    GE_BREAK(NULL, 0);
-    return NULL; /* error */  
-  }
-  
-  contentSize = * (unsigned int*) result[0].buffer;
-  if (contentSize < sizeof(Datastore_Value))
+  if ((result[0].buffer_type != MYSQL_TYPE_LONG) ||
+      (!result[0].is_unsigned) ||
+      (result[1].buffer_type != MYSQL_TYPE_LONG) ||
+      (!result[1].is_unsigned) ||
+      (result[2].buffer_type != MYSQL_TYPE_LONG) ||
+      (!result[2].is_unsigned) ||
+      (result[3].buffer_type != MYSQL_TYPE_LONG) ||
+      (!result[3].is_unsigned) ||
+      (result[4].buffer_type != MYSQL_TYPE_LONGLONG) ||
+      (!result[4].is_unsigned) ||
+      (result[5].buffer_type != MYSQL_TYPE_BLOB) ||
+      (result[5].buffer_length != sizeof (HashCode512)) ||
+      (*result[5].length != sizeof (HashCode512)) ||
+      (result[6].buffer_type != MYSQL_TYPE_LONGLONG) ||
+      (!result[6].is_unsigned))
+    {
+      GE_BREAK (NULL, 0);
+      return NULL;              /* error */
+    }
+
+  contentSize = *(unsigned int *) result[0].buffer;
+  if (contentSize < sizeof (Datastore_Value))
     return NULL;                /* error */
-  contentSize -= sizeof(Datastore_Value);
-  type = *(unsigned int*) result[1].buffer;
-  prio = *(unsigned int*) result[2].buffer;
-  level = *(unsigned int*) result[3].buffer;
-  exp = *(unsigned long long*) result[4].buffer;
-  vkey = *(unsigned long long*) result[6].buffer;
+  contentSize -= sizeof (Datastore_Value);
+  type = *(unsigned int *) result[1].buffer;
+  prio = *(unsigned int *) result[2].buffer;
+  level = *(unsigned int *) result[3].buffer;
+  exp = *(unsigned long long *) result[4].buffer;
+  vkey = *(unsigned long long *) result[6].buffer;
   datum = MALLOC (sizeof (Datastore_Value) + contentSize);
   datum->size = htonl (contentSize + sizeof (Datastore_Value));
   datum->type = htonl (type);
@@ -594,27 +601,26 @@
 
   /* now do query on gn072 */
   length = contentSize;
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].is_unsigned = YES;
   qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[0].buffer = &vkey;
-  memset(rbind, 0, sizeof(rbind));
+  memset (rbind, 0, sizeof (rbind));
   rbind[0].buffer_type = MYSQL_TYPE_BLOB;
   rbind[0].buffer_length = contentSize;
   rbind[0].length = &length;
   rbind[0].buffer = &datum[1];
-  GE_ASSERT (ectx,
-            mysql_stmt_param_count (dbh->select_value) == 1);
-  if (mysql_stmt_bind_param(dbh->select_value,
-                           qbind)) {
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_param",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
-    iclose ();
-    return NULL;
-  }
+  GE_ASSERT (ectx, mysql_stmt_param_count (dbh->select_value) == 1);
+  if (mysql_stmt_bind_param (dbh->select_value, qbind))
+    {
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_param",
+              __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
+      iclose ();
+      return NULL;
+    }
   if (mysql_stmt_execute (dbh->select_value))
     {
       GE_LOG (ectx,
@@ -625,32 +631,31 @@
       iclose ();
       return NULL;
     }
-  GE_ASSERT (ectx,
-            mysql_stmt_field_count (dbh->select_value) == 1);
-  if (mysql_stmt_bind_result(dbh->select_value,
-                            rbind)) {
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_result",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
-    iclose ();
-    return NULL;
-  }
-  if ( (0 != mysql_stmt_fetch(dbh->select_value)) ||
-       (rbind[0].buffer_length != contentSize) ||
-       (length != contentSize) ) {
-    mysql_stmt_reset(dbh->select_value);
-    GE_LOG (ectx,
-           GE_ERROR | GE_BULK | GE_USER,
-           _("`%s' failed at %s:%d with error: %s\n"),
-           "mysql_stmt_bind_result",
-           __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
-    delete_entry_by_vkey(vkey);
-    content_size -= ntohl(datum->size);
-    return NULL;
-  }
-  mysql_stmt_reset(dbh->select_value);
+  GE_ASSERT (ectx, mysql_stmt_field_count (dbh->select_value) == 1);
+  if (mysql_stmt_bind_result (dbh->select_value, rbind))
+    {
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_result",
+              __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
+      iclose ();
+      return NULL;
+    }
+  if ((0 != mysql_stmt_fetch (dbh->select_value)) ||
+      (rbind[0].buffer_length != contentSize) || (length != contentSize))
+    {
+      mysql_stmt_reset (dbh->select_value);
+      GE_LOG (ectx,
+              GE_ERROR | GE_BULK | GE_USER,
+              _("`%s' failed at %s:%d with error: %s\n"),
+              "mysql_stmt_bind_result",
+              __FILE__, __LINE__, mysql_stmt_error (dbh->select_value));
+      delete_entry_by_vkey (vkey);
+      content_size -= ntohl (datum->size);
+      return NULL;
+    }
+  mysql_stmt_reset (dbh->select_value);
   return datum;
 }
 
@@ -675,8 +680,8 @@
   EncName enc;
 #endif
 
-  if ( ((ntohl (value->size) < sizeof (Datastore_Value))) ||
-       ((ntohl (value->size) - sizeof (Datastore_Value)) > MAX_DATUM_SIZE) )   
 
+  if (((ntohl (value->size) < sizeof (Datastore_Value))) ||
+      ((ntohl (value->size) - sizeof (Datastore_Value)) > MAX_DATUM_SIZE))
     {
       GE_BREAK (ectx, 0);
       return SYSERR;
@@ -690,13 +695,12 @@
       return SYSERR;
     }
   contentSize = ntohl (value->size) - sizeof (Datastore_Value);
-  if (OK != insert_value(&value[1],
-                        contentSize,
-                        &vkey)) {
-    mysql_thread_end ();
-    MUTEX_UNLOCK (lock);
-    return SYSERR;
-  }
+  if (OK != insert_value (&value[1], contentSize, &vkey))
+    {
+      mysql_thread_end ();
+      MUTEX_UNLOCK (lock);
+      return SYSERR;
+    }
   hashSize = sizeof (HashCode512);
   size = ntohl (value->size);
   type = ntohl (value->type);
@@ -709,30 +713,29 @@
           GE_DEBUG | GE_REQUEST | GE_USER,
           "Storing in database block with type %u and key %s.\n", type, &enc);
 #endif
-  GE_ASSERT (ectx,
-            mysql_stmt_param_count (dbh->insert_entry) == 7);
-  memset(qbind, 0, sizeof (qbind));
-  qbind[0].buffer_type = MYSQL_TYPE_LONG;      /* size */
+  GE_ASSERT (ectx, mysql_stmt_param_count (dbh->insert_entry) == 7);
+  memset (qbind, 0, sizeof (qbind));
+  qbind[0].buffer_type = MYSQL_TYPE_LONG;       /* size */
   qbind[0].buffer = &size;
   qbind[0].is_unsigned = YES;
-  qbind[1].buffer_type = MYSQL_TYPE_LONG;      /* type */
+  qbind[1].buffer_type = MYSQL_TYPE_LONG;       /* type */
   qbind[1].is_unsigned = YES;
   qbind[1].buffer = &type;
-  qbind[2].buffer_type = MYSQL_TYPE_LONG;      /* prio */
+  qbind[2].buffer_type = MYSQL_TYPE_LONG;       /* prio */
   qbind[2].is_unsigned = YES;
   qbind[2].buffer = &prio;
-  qbind[3].buffer_type = MYSQL_TYPE_LONG;      /* anon level */
+  qbind[3].buffer_type = MYSQL_TYPE_LONG;       /* anon level */
   qbind[3].is_unsigned = YES;
   qbind[3].buffer = &level;
-  qbind[4].buffer_type = MYSQL_TYPE_LONGLONG;  /* expiration */
+  qbind[4].buffer_type = MYSQL_TYPE_LONGLONG;   /* expiration */
   qbind[4].is_unsigned = YES;
   qbind[4].buffer = &expiration;
-  qbind[5].buffer_type = MYSQL_TYPE_BLOB; /* hash */
-  qbind[5].buffer = (void*) key;
+  qbind[5].buffer_type = MYSQL_TYPE_BLOB;       /* hash */
+  qbind[5].buffer = (void *) key;
   qbind[5].length = &hashSize;
   qbind[5].buffer_length = hashSize;
   qbind[6].buffer_type = MYSQL_TYPE_LONGLONG;   /* vkey */
-  qbind[6].is_unsigned = YES; 
+  qbind[6].is_unsigned = YES;
   qbind[6].buffer = &vkey;
 
   if (mysql_stmt_bind_param (dbh->insert_entry, qbind))
@@ -742,7 +745,7 @@
               _("`%s' failed at %s:%d with error: %s\n"),
               "mysql_stmt_bind_param",
               __FILE__, __LINE__, mysql_stmt_error (dbh->insert_entry));
-      delete_value(vkey);
+      delete_value (vkey);
       iclose ();
       mysql_thread_end ();
       MUTEX_UNLOCK (lock);
@@ -756,7 +759,7 @@
               _("`%s' failed at %s:%d with error: %s\n"),
               "mysql_stmt_execute",
               __FILE__, __LINE__, mysql_stmt_error (dbh->insert_entry));
-      delete_value(vkey);      
+      delete_value (vkey);
       iclose ();
       mysql_thread_end ();
       MUTEX_UNLOCK (lock);
@@ -786,11 +789,11 @@
  */
 static int
 iterateHelper (unsigned int type,
-              int is_asc,
-              int is_prio,
+               int is_asc,
+               int is_prio,
                MYSQL_STMT * stmt, Datum_Iterator iter, void *closure)
 {
-  Datastore_Value * datum;
+  Datastore_Value *datum;
   int count;
   int ret;
   unsigned int last_prio;
@@ -808,31 +811,37 @@
   MYSQL_BIND qbind[5];
   MYSQL_BIND rbind[7];
 
-  if (is_asc) {
-    last_prio = 0;
-    last_vkey = 0;
-    last_expire = 0;
-  } else {
-    last_prio = 0x7FFFFFFFL;
-    last_vkey = 0x7FFFFFFFFFFFFFFFLL; /* MySQL only supports 63 bits */
-    last_expire = 0x7FFFFFFFFFFFFFFFLL; /* MySQL only supports 63 bits */
-  }
-  memset(qbind, 0, sizeof(qbind));
-  if (is_prio) {
-    qbind[0].buffer_type = MYSQL_TYPE_LONG;
-    qbind[0].buffer = &last_prio;
-    qbind[0].is_unsigned = YES;
-    qbind[2].buffer_type = MYSQL_TYPE_LONG;
-    qbind[2].buffer = &last_prio;  
-    qbind[2].is_unsigned = YES;
-  } else {
-    qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
-    qbind[0].buffer = &last_expire;
-    qbind[0].is_unsigned = YES;
-    qbind[2].buffer_type = MYSQL_TYPE_LONGLONG;
-    qbind[2].buffer = &last_expire;  
-    qbind[2].is_unsigned = YES;
-  }
+  if (is_asc)
+    {
+      last_prio = 0;
+      last_vkey = 0;
+      last_expire = 0;
+    }
+  else
+    {
+      last_prio = 0x7FFFFFFFL;
+      last_vkey = 0x7FFFFFFFFFFFFFFFLL; /* MySQL only supports 63 bits */
+      last_expire = 0x7FFFFFFFFFFFFFFFLL;       /* MySQL only supports 63 bits 
*/
+    }
+  memset (qbind, 0, sizeof (qbind));
+  if (is_prio)
+    {
+      qbind[0].buffer_type = MYSQL_TYPE_LONG;
+      qbind[0].buffer = &last_prio;
+      qbind[0].is_unsigned = YES;
+      qbind[2].buffer_type = MYSQL_TYPE_LONG;
+      qbind[2].buffer = &last_prio;
+      qbind[2].is_unsigned = YES;
+    }
+  else
+    {
+      qbind[0].buffer_type = MYSQL_TYPE_LONGLONG;
+      qbind[0].buffer = &last_expire;
+      qbind[0].is_unsigned = YES;
+      qbind[2].buffer_type = MYSQL_TYPE_LONGLONG;
+      qbind[2].buffer = &last_expire;
+      qbind[2].is_unsigned = YES;
+    }
   qbind[1].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[1].buffer = &last_vkey;
   qbind[1].is_unsigned = YES;
@@ -843,9 +852,9 @@
   qbind[4].buffer = &now;
   qbind[4].is_unsigned = YES;
   GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 5);
-  
-  hashSize = sizeof(HashCode512);
-  memset(rbind, 0, sizeof(rbind));
+
+  hashSize = sizeof (HashCode512);
+  memset (rbind, 0, sizeof (rbind));
   rbind[0].buffer_type = MYSQL_TYPE_LONG;
   rbind[0].buffer = &size;
   rbind[0].is_unsigned = YES;
@@ -868,90 +877,91 @@
   rbind[6].buffer_type = MYSQL_TYPE_LONGLONG;
   rbind[6].buffer = &vkey;
   rbind[6].is_unsigned = YES;
-  GE_ASSERT (ectx,
-            mysql_stmt_field_count (stmt) == 7);
+  GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
 
   mysql_thread_init ();
   count = 0;
-  while (1) {
-    MUTEX_LOCK (lock);
-    if (OK != CHECK_DBH) {
+  while (1)
+    {
+      MUTEX_LOCK (lock);
+      if (OK != CHECK_DBH)
+        {
+          MUTEX_UNLOCK (lock);
+          mysql_thread_end ();
+          return SYSERR;
+        }
+      now = get_time ();
+      if (mysql_stmt_bind_param (stmt, qbind))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_bind_param",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          MUTEX_UNLOCK (lock);
+          mysql_thread_end ();
+          return SYSERR;
+        }
+      if (mysql_stmt_execute (stmt))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_execute",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          MUTEX_UNLOCK (lock);
+          mysql_thread_end ();
+          return SYSERR;
+        }
+      if (mysql_stmt_bind_result (stmt, rbind))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_bind_result",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          mysql_thread_end ();
+          MUTEX_UNLOCK (lock);
+          return SYSERR;
+        }
+      datum = NULL;
+      if (0 != mysql_stmt_fetch (stmt))
+        {
+          mysql_stmt_reset (stmt);
+          MUTEX_UNLOCK (lock);
+          break;
+        }
+      mysql_stmt_reset (stmt);
       MUTEX_UNLOCK (lock);
-      mysql_thread_end ();
-      return SYSERR; 
+      last_vkey = vkey;
+      last_prio = prio;
+      last_expire = expiration;
+      count++;
+      if (iter != NULL)
+        {
+          datum = assembleDatum (rbind);
+          if (datum == NULL)
+            continue;
+          if (iter == NULL)
+            ret = OK;
+          else
+            ret = iter (&key, datum, closure, vkey);
+          if (ret == SYSERR)
+            break;
+          if (ret == NO)
+            {
+              MUTEX_LOCK (lock);
+              delete_value (vkey);
+              delete_entry_by_vkey (vkey);
+              content_size -= ntohl (datum->size);
+              MUTEX_UNLOCK (lock);
+            }
+          FREE (datum);
+        }
     }
-    now = get_time ();
-    if (mysql_stmt_bind_param (stmt, qbind))
-      {
-       GE_LOG (ectx,
-               GE_ERROR | GE_BULK | GE_USER,
-               _("`%s' failed at %s:%d with error: %s\n"),
-               "mysql_stmt_bind_param",
-               __FILE__, __LINE__, mysql_stmt_error (stmt));
-       iclose ();
-       MUTEX_UNLOCK (lock);
-       mysql_thread_end ();
-       return SYSERR;
-      }
-    if (mysql_stmt_execute (stmt))
-      {
-       GE_LOG (ectx,
-               GE_ERROR | GE_BULK | GE_USER,
-               _("`%s' failed at %s:%d with error: %s\n"),
-               "mysql_stmt_execute",
-               __FILE__, __LINE__, mysql_stmt_error (stmt));
-       iclose ();
-       MUTEX_UNLOCK (lock);
-       mysql_thread_end ();
-       return SYSERR;
-      }    
-    if (mysql_stmt_bind_result(stmt,
-                              rbind)) {
-      GE_LOG (ectx,
-             GE_ERROR | GE_BULK | GE_USER,
-             _("`%s' failed at %s:%d with error: %s\n"),
-             "mysql_stmt_bind_result",
-             __FILE__, __LINE__, mysql_stmt_error (stmt));
-      iclose ();
-      mysql_thread_end ();
-      MUTEX_UNLOCK (lock);
-      return SYSERR;
-    }
-    datum = NULL;
-    if (0 != mysql_stmt_fetch(stmt)) {
-      mysql_stmt_reset(stmt);
-      MUTEX_UNLOCK (lock);
-      break;
-    }
-    mysql_stmt_reset(stmt);
-    MUTEX_UNLOCK (lock);
-    last_vkey = vkey;
-    last_prio = prio;
-    last_expire = expiration;
-    count++;
-    if (iter != NULL) {
-      datum = assembleDatum(rbind);    
-      if (datum == NULL)
-       continue;
-      if (iter == NULL)
-       ret = OK;
-      else
-       ret = iter(&key,
-                  datum,
-                  closure,
-                  vkey);
-      if (ret == SYSERR) 
-       break;        
-      if (ret == NO) {
-       MUTEX_LOCK (lock);
-       delete_value(vkey);
-       delete_entry_by_vkey(vkey);
-       content_size -= ntohl(datum->size);
-       MUTEX_UNLOCK (lock);
-      }
-      FREE(datum);
-    }
-  }
   mysql_thread_end ();
   return count;
 }
@@ -969,11 +979,7 @@
 static int
 iterateLowPriority (unsigned int type, Datum_Iterator iter, void *closure)
 {
-  return iterateHelper (type,
-                       YES, YES,
-                        dbh->ilow,
-                        iter, 
-                       closure);
+  return iterateHelper (type, YES, YES, dbh->ilow, iter, closure);
 }
 
 /**
@@ -987,14 +993,9 @@
  *   iter is non-NULL and aborted the iteration
  */
 static int
-iterateNonAnonymous (unsigned int type,
-                     Datum_Iterator iter, void *closure)
+iterateNonAnonymous (unsigned int type, Datum_Iterator iter, void *closure)
 {
-  return iterateHelper (type,
-                       NO, YES,
-                       dbh->inon,
-                       iter,
-                       closure);
+  return iterateHelper (type, NO, YES, dbh->inon, iter, closure);
 }
 
 /**
@@ -1010,11 +1011,7 @@
 static int
 iterateExpirationTime (unsigned int type, Datum_Iterator iter, void *closure)
 {
-  return iterateHelper (type,
-                       YES, NO,
-                        dbh->iexp,
-                       iter,
-                       closure);
+  return iterateHelper (type, YES, NO, dbh->iexp, iter, closure);
 }
 
 /**
@@ -1028,12 +1025,7 @@
 static int
 iterateMigrationOrder (Datum_Iterator iter, void *closure)
 {
-  return iterateHelper (0,
-                       NO,
-                       NO,
-                        dbh->imig,
-                       iter,
-                       closure);
+  return iterateHelper (0, NO, NO, dbh->imig, iter, closure);
 }
 
 /**
@@ -1047,11 +1039,7 @@
 static int
 iterateAllNow (Datum_Iterator iter, void *closure)
 {
-  return iterateHelper (0, 
-                       YES,
-                       YES,
-                       dbh->ilow,
-                       iter, closure);
+  return iterateHelper (0, YES, YES, dbh->ilow, iter, closure);
 }
 
 /**
@@ -1071,7 +1059,7 @@
 {
   int count;
   int ret;
-  MYSQL_STMT * stmt;
+  MYSQL_STMT *stmt;
   unsigned int size;
   unsigned int rtype;
   unsigned int prio;
@@ -1079,7 +1067,7 @@
   unsigned long long expiration;
   unsigned long long vkey;
   unsigned long long last_vkey;
-  Datastore_Value * datum;
+  Datastore_Value *datum;
   HashCode512 key;
   unsigned long hashSize;
   MYSQL_BIND qbind[3];
@@ -1114,20 +1102,19 @@
 
   hashSize = sizeof (HashCode512);
   GE_ASSERT (ectx, mysql_stmt_param_count (stmt) <= 3);
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].buffer_type = MYSQL_TYPE_BLOB;
-  qbind[0].buffer = (void*) query;
+  qbind[0].buffer = (void *) query;
   qbind[0].length = &hashSize;
-  qbind[0].buffer_length = hashSize;  
+  qbind[0].buffer_length = hashSize;
   qbind[1].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[1].is_unsigned = YES;
   qbind[1].buffer = &last_vkey;
   qbind[2].buffer_type = MYSQL_TYPE_LONG;
   qbind[2].is_unsigned = YES;
   qbind[2].buffer = &type;
-  GE_ASSERT (ectx,
-            mysql_stmt_field_count (stmt) == 7);
-  memset(rbind, 0, sizeof(rbind));
+  GE_ASSERT (ectx, mysql_stmt_field_count (stmt) == 7);
+  memset (rbind, 0, sizeof (rbind));
   rbind[0].buffer_type = MYSQL_TYPE_LONG;
   rbind[0].buffer = &size;
   rbind[0].is_unsigned = YES;
@@ -1155,86 +1142,86 @@
   mysql_thread_init ();
   last_vkey = 0;
   count = 0;
-  while (1) {
-    MUTEX_LOCK (lock);
-    if (OK != CHECK_DBH)
-      {
-       MUTEX_UNLOCK (lock);
-       mysql_thread_end ();
-       return SYSERR;
-      }
-    if (mysql_stmt_bind_param (stmt, qbind))
-      {
-       GE_LOG (ectx,
-               GE_ERROR | GE_BULK | GE_USER,
-               _("`%s' failed at %s:%d with error: %s\n"),
-               "mysql_stmt_bind_param",
-               __FILE__, __LINE__, mysql_stmt_error (stmt));
-       iclose ();
-       mysql_thread_end ();
-       MUTEX_UNLOCK (lock);
-       return SYSERR;
-      }
-    if (mysql_stmt_execute (stmt))
-      {
-       GE_LOG (ectx,
-               GE_ERROR | GE_BULK | GE_USER,
-               _("`%s' failed at %s:%d with error: %s\n"),
-               "mysql_stmt_execute",
-               __FILE__, __LINE__, mysql_stmt_error (stmt));
-       iclose ();
-       MUTEX_UNLOCK (lock);
-       mysql_thread_end ();
-       return SYSERR;
-      }
-    if (mysql_stmt_bind_result(stmt,
-                              rbind)) {
-      GE_LOG (ectx,
-             GE_ERROR | GE_BULK | GE_USER,
-             _("`%s' failed at %s:%d with error: %s\n"),
-             "mysql_stmt_bind_result",
-             __FILE__, __LINE__, mysql_stmt_error (stmt));
-      iclose ();
-      mysql_thread_end ();
+  while (1)
+    {
+      MUTEX_LOCK (lock);
+      if (OK != CHECK_DBH)
+        {
+          MUTEX_UNLOCK (lock);
+          mysql_thread_end ();
+          return SYSERR;
+        }
+      if (mysql_stmt_bind_param (stmt, qbind))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_bind_param",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          mysql_thread_end ();
+          MUTEX_UNLOCK (lock);
+          return SYSERR;
+        }
+      if (mysql_stmt_execute (stmt))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_execute",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          MUTEX_UNLOCK (lock);
+          mysql_thread_end ();
+          return SYSERR;
+        }
+      if (mysql_stmt_bind_result (stmt, rbind))
+        {
+          GE_LOG (ectx,
+                  GE_ERROR | GE_BULK | GE_USER,
+                  _("`%s' failed at %s:%d with error: %s\n"),
+                  "mysql_stmt_bind_result",
+                  __FILE__, __LINE__, mysql_stmt_error (stmt));
+          iclose ();
+          mysql_thread_end ();
+          MUTEX_UNLOCK (lock);
+          return SYSERR;
+        }
+      if (0 != mysql_stmt_fetch (stmt))
+        {
+          mysql_stmt_reset (stmt);
+          MUTEX_UNLOCK (lock);
+          break;
+        }
+      last_vkey = vkey;
+      if (iter == NULL)
+        {
+          count = mysql_stmt_affected_rows (stmt);
+          mysql_stmt_reset (stmt);
+          mysql_thread_end ();
+          MUTEX_UNLOCK (lock);
+
+          return count;
+        }
+      mysql_stmt_reset (stmt);
+      datum = assembleDatum (rbind);
       MUTEX_UNLOCK (lock);
-      return SYSERR;
-    }    
-    if (0 != mysql_stmt_fetch(stmt)) {     
-      mysql_stmt_reset(stmt);
-      MUTEX_UNLOCK(lock);
-      break;
+      if (datum == NULL)
+        continue;
+      count++;
+      ret = iter (&key, datum, closure, vkey);
+      if (ret == SYSERR)
+        break;
+      if (ret == NO)
+        {
+          MUTEX_LOCK (lock);
+          delete_value (vkey);
+          delete_entry_by_vkey (vkey);
+          content_size -= ntohl (datum->size);
+          MUTEX_UNLOCK (lock);
+        }
+      FREE (datum);
     }
-    last_vkey = vkey;
-    if (iter == NULL)
-      {
-       count = mysql_stmt_affected_rows (stmt);
-       mysql_stmt_reset (stmt);
-       mysql_thread_end ();
-       MUTEX_UNLOCK (lock);
-    
-       return count;
-      }
-    mysql_stmt_reset(stmt);
-    datum = assembleDatum(rbind);
-    MUTEX_UNLOCK(lock);
-    if (datum == NULL) 
-      continue;    
-    count++;
-    ret = iter(&key,
-              datum,
-              closure,
-              vkey);
-    if (ret == SYSERR) 
-      break;    
-    if (ret == NO) {
-      MUTEX_LOCK(lock);
-      delete_value(vkey);
-      delete_entry_by_vkey(vkey);
-      content_size -= ntohl(datum->size);
-      MUTEX_UNLOCK(lock);
-    }
-    FREE(datum);
-  }
   mysql_thread_end ();
   return count;
 }
@@ -1244,8 +1231,7 @@
  * in the datastore.
  */
 static int
-update (unsigned long long vkey,
-        int delta, cron_t expire)
+update (unsigned long long vkey, int delta, cron_t expire)
 {
   cron_t start;
   MYSQL_BIND qbind[4];
@@ -1258,7 +1244,7 @@
       MUTEX_UNLOCK (lock);
       return SYSERR;
     }
-  memset(qbind, 0, sizeof(qbind));
+  memset (qbind, 0, sizeof (qbind));
   qbind[0].buffer_type = MYSQL_TYPE_LONG;
   qbind[0].buffer = &delta;
   qbind[1].buffer_type = MYSQL_TYPE_LONGLONG;
@@ -1266,7 +1252,7 @@
   qbind[1].is_unsigned = YES;
   qbind[2].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[2].is_unsigned = YES;
-  qbind[2].buffer = &expire; 
+  qbind[2].buffer = &expire;
   qbind[3].buffer_type = MYSQL_TYPE_LONGLONG;
   qbind[3].is_unsigned = YES;
   qbind[3].buffer = &vkey;
@@ -1302,7 +1288,7 @@
       MUTEX_UNLOCK (lock);
       return SYSERR;
     }
-  mysql_stmt_reset(dbh->update_entry);
+  mysql_stmt_reset (dbh->update_entry);
   mysql_thread_end ();
   MUTEX_UNLOCK (lock);
   return OK;
@@ -1325,7 +1311,7 @@
   if (stats)
     stats->set (stat_size, ret);
   MUTEX_UNLOCK (lock);
-  return ret * 2; /* FIXME: measure again! */
+  return ret * 2;               /* FIXME: measure again! */
 }
 
 /**
@@ -1358,9 +1344,9 @@
       LOG_MYSQL (GE_ERROR | GE_ADMIN | GE_BULK, "mysql_query", dbh);
       ok = NO;
     }
-  if (ok == YES)    
-      content_size = 0;    
-  iclose();
+  if (ok == YES)
+    content_size = 0;
+  iclose ();
   mysql_thread_end ();
   MUTEX_UNLOCK (lock);
 }
@@ -1421,7 +1407,7 @@
       fclose (fp);
     }
   dbh = MALLOC (sizeof (mysqlHandle));
-  memset(dbh, 0, sizeof(mysqlHandle));
+  memset (dbh, 0, sizeof (mysqlHandle));
   dbh->cnffile = cnffile;
   if (OK != iopen ())
     {
@@ -1524,7 +1510,14 @@
  * Update mysql database module.
  */
 void
-update_module_sqstore_mysql (UpdateAPI * uapi) {
+update_module_sqstore_mysql (UpdateAPI * uapi)
+{
+  char *cnffile;
+  FILE *fp;
+  struct passwd *pw;
+  size_t nX;
+  char *home_dir;
+
   ectx = uapi->ectx;
 #ifndef WINDOWS
   pw = getpwuid (getuid ());
@@ -1559,7 +1552,7 @@
       fclose (fp);
     }
   dbh = MALLOC (sizeof (mysqlHandle));
-  memset(dbh, 0, sizeof(mysqlHandle));
+  memset (dbh, 0, sizeof (mysqlHandle));
   dbh->cnffile = cnffile;
   if (OK != iopen ())
     {
@@ -1572,16 +1565,20 @@
       dbh = NULL;
       return;
     }
-  if ( (0 == mysql_query(dbh->dbf,
-                        "ALTER TABLE gn070 ADD COLUMN vkey BIGINT UNSIGNED 
PRIMARY KEY AUTO_INCREMENT")) &&
-       (0 == mysql_query(dbh->dbf,
-                        "INSERT INTO gn071 
(size,type,prio,anonLevel,expire,hash,vkey) (SELECT 
size,type,prio,anonLevel,expire,hash,vkey FROM gn070)")) &&
-       (0 == mysql_query(dbh->dbf,
-                        "INSERT INTO gn072 (vkey,value) (SELECT vkey,value 
FROM gn070)") ) )
-    mysql_query("DROP TABLE gn070");
-  
-  }  
-  iclose();
+  if ((0 == mysql_query (dbh->dbf,
+                         "ALTER TABLE gn070 ADD COLUMN vkey BIGINT UNSIGNED 
PRIMARY KEY AUTO_INCREMENT"))
+      && (0 ==
+          mysql_query (dbh->dbf,
+                       "INSERT INTO gn071 
(size,type,prio,anonLevel,expire,hash,vkey) (SELECT 
size,type,prio,anonLevel,expire,hash,vkey FROM gn070)"))
+      && (0 ==
+          mysql_query (dbh->dbf,
+                       "INSERT INTO gn072 (vkey,value) (SELECT vkey,value FROM 
gn070)")))
+    mysql_query (dbh->dbf, "DROP TABLE gn070");
+
+  iclose (dbh);
+  FREE (dbh->cnffile);
+  FREE (dbh);
+  dbh = NULL;
   mysql_library_end ();
   ectx = NULL;
 }

Modified: GNUnet/src/applications/sqstore_mysql/mysqltest.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest.c   2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest.c   2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -53,7 +53,7 @@
 static int
 checkValue (const HashCode512 * key,
             const Datastore_Value * val, void *closure,
-           unsigned long long uid)
+            unsigned long long uid)
 {
   int i;
   int ret;
@@ -79,7 +79,7 @@
 
 static int
 iterateUp (const HashCode512 * key, const Datastore_Value * val, int *closure,
-          unsigned long long uid)
+           unsigned long long uid)
 {
   int ret;
 
@@ -91,7 +91,7 @@
 static int
 iterateDown (const HashCode512 * key,
              const Datastore_Value * val, int *closure,
-            unsigned long long uid)
+             unsigned long long uid)
 {
   int ret;
 
@@ -102,25 +102,25 @@
 
 static int
 iterateDelete (const HashCode512 * key,
-               const Datastore_Value * val, void * closure,
-              unsigned long long uid)
+               const Datastore_Value * val, void *closure,
+               unsigned long long uid)
 {
   return NO;
 }
 
 static int
 iteratePriority (const HashCode512 * key,
-                const Datastore_Value * val, SQstore_ServiceAPI * api,
-                unsigned long long uid)
+                 const Datastore_Value * val, SQstore_ServiceAPI * api,
+                 unsigned long long uid)
 {
-  api->update(uid, 4, 0);
+  api->update (uid, 4, 0);
   return OK;
 }
 
 static int
 priorityCheck (const HashCode512 * key,
                const Datastore_Value * val, int *closure,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   int id;
 
@@ -134,7 +134,7 @@
 static int
 multipleCheck (const HashCode512 * key,
                const Datastore_Value * val, Datastore_Value ** last,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   if (*last != NULL)
     {
@@ -209,8 +209,7 @@
   ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
                                            (Datum_Iterator) & priorityCheck,
                                            &i));
-  ASSERT (1 == api->iterateAllNow((Datum_Iterator) & iteratePriority,
-                                 api));
+  ASSERT (1 == api->iterateAllNow ((Datum_Iterator) & iteratePriority, api));
   i += 4;
   ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
                                            (Datum_Iterator) & priorityCheck,
@@ -227,8 +226,7 @@
                                            (Datum_Iterator) & multipleCheck,
                                            &value));
   FREE (value);
-  ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete,
-                                  api));
+  ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete, api));
   ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
   api->drop ();
 

Modified: GNUnet/src/applications/sqstore_mysql/mysqltest2.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest2.c  2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest2.c  2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -166,8 +166,7 @@
 
 static int
 iterateDelete (const HashCode512 * key,
-               const Datastore_Value * val, void *cls,
-              unsigned long long uid)
+               const Datastore_Value * val, void *cls, unsigned long long uid)
 {
   SQstore_ServiceAPI *api = cls;
   static int dc;
@@ -226,8 +225,7 @@
 #if REPORT_ID
                "\n"
 #endif
-               "Useful %llu, API %llu, disk %llu (%.2f%%) / %lluk ops / %llu 
ops/s\n", 
-              stored_bytes / 1024,     /* used size in k */
+               "Useful %llu, API %llu, disk %llu (%.2f%%) / %lluk ops / %llu 
ops/s\n", stored_bytes / 1024,     /* used size in k */
                api->getSize () / 1024,  /* API-reported size in k */
                size / 1024,     /* disk size in kb */
                (100.0 * size / stored_bytes) - 100,     /* overhead */

Modified: GNUnet/src/applications/sqstore_mysql/mysqltest3.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest3.c  2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest3.c  2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -71,7 +71,7 @@
   size = size - (size & 7);     /* always multiple of 8 */
 
   /* generate random key */
-  key.bits[0] = (unsigned int) get_time();
+  key.bits[0] = (unsigned int) get_time ();
   hash (&key, sizeof (HashCode512), &key);
   value = MALLOC (size);
   value->size = htonl (size);
@@ -97,7 +97,7 @@
 
 static int
 iterateDummy (const HashCode512 * key, const Datastore_Value * val, void *cls,
-             unsigned long long uid)
+              unsigned long long uid)
 {
   if (GNUNET_SHUTDOWN_TEST () == YES)
     return SYSERR;
@@ -131,35 +131,40 @@
       start = get_time ();
       ret = api->iterateLowPriority (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u low priority iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u low priority iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateExpirationTime (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u expiration t iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u expiration t iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateNonAnonymous (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u non anonymou iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u non anonymou iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateMigrationOrder (&iterateDummy, api);
       end = get_time ();
-      printf ("%3u migration or iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u migration or iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateAllNow (&iterateDummy, api);
       end = get_time ();
-      printf ("%3u all now      iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u all now      iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
     }
-  api->drop();
+  api->drop ();
   return OK;
 }
 

Modified: GNUnet/src/applications/sqstore_sqlite/sqlite.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlite.c     2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_sqlite/sqlite.c     2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -363,23 +363,26 @@
   /* benchmarking shows 13% overhead */
 }
 
-static int delete_by_rowid(sqliteHandle * handle,
-                          unsigned long long rid) {
+static int
+delete_by_rowid (sqliteHandle * handle, unsigned long long rid)
+{
   sqlite3_stmt *stmt;
-  
+
   if (sq_prepare (handle->dbh,
-                 "DELETE FROM gn070 WHERE _ROWID_ = ?", &stmt) != SQLITE_OK) {
-    LOG_SQLITE (handle,
-               GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sq_prepare");
-    return SYSERR;
-  }
+                  "DELETE FROM gn070 WHERE _ROWID_ = ?", &stmt) != SQLITE_OK)
+    {
+      LOG_SQLITE (handle,
+                  GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sq_prepare");
+      return SYSERR;
+    }
   sqlite3_bind_int64 (stmt, 1, rid);
-  if (SQLITE_DONE != sqlite3_step (stmt)) {
-    LOG_SQLITE (handle,
-               GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_step");
-    sqlite3_finalize (stmt);
-    return SYSERR;
-  }
+  if (SQLITE_DONE != sqlite3_step (stmt))
+    {
+      LOG_SQLITE (handle,
+                  GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_step");
+      sqlite3_finalize (stmt);
+      return SYSERR;
+    }
   sqlite3_finalize (stmt);
   return OK;
 }
@@ -390,8 +393,7 @@
  */
 static Datastore_Value *
 assembleDatum (sqliteHandle * handle, sqlite3_stmt * stmt,
-              HashCode512 * key,
-              unsigned long long * rowid)
+               HashCode512 * key, unsigned long long *rowid)
 {
   Datastore_Value *value;
   int contentSize;
@@ -458,7 +460,7 @@
   value->prio = htonl (sqlite3_column_int (stmt, 2));
   value->anonymityLevel = htonl (sqlite3_column_int (stmt, 3));
   value->expirationTime = htonll (sqlite3_column_int64 (stmt, 4));
-  memcpy (key, sqlite3_column_blob (stmt, 5), sizeof(HashCode512));
+  memcpy (key, sqlite3_column_blob (stmt, 5), sizeof (HashCode512));
   memcpy (&value[1], sqlite3_column_blob (stmt, 6), contentSize);
   return value;
 }
@@ -587,7 +589,7 @@
   sqliteHandle *handle;
   int ret;
   cron_t now;
-  unsigned long long rowid;  
+  unsigned long long rowid;
 
   handle = getDBHandle ();
   dbh = handle->dbh;
@@ -715,18 +717,19 @@
               if (iter != NULL)
                 {
                   ret = iter (&key, datum, closure, rowid);
-                 if (ret == SYSERR)            
+                  if (ret == SYSERR)
                     {
                       FREE (datum);
                       count = SYSERR;
                       break;
                     }
-                 if (ret == NO) {
-                   MUTEX_LOCK(db->DATABASE_Lock_);
-                   db->payload -= getContentDatastoreSize (datum);
-                   MUTEX_UNLOCK(db->DATABASE_Lock_);
-                   delete_by_rowid(handle, rowid);
-                 }
+                  if (ret == NO)
+                    {
+                      MUTEX_LOCK (db->DATABASE_Lock_);
+                      db->payload -= getContentDatastoreSize (datum);
+                      MUTEX_UNLOCK (db->DATABASE_Lock_);
+                      delete_by_rowid (handle, rowid);
+                    }
                 }
             }
           lastPrio = ntohl (datum->prio);
@@ -779,8 +782,7 @@
  *   iter is non-NULL and aborted the iteration
  */
 static int
-iterateNonAnonymous (unsigned int type,
-                     Datum_Iterator iter, void *closure)
+iterateNonAnonymous (unsigned int type, Datum_Iterator iter, void *closure)
 {
   return sqlite_iterate (0, iter, closure, NO, NO, NO, YES, YES);
 }
@@ -844,7 +846,7 @@
      http://permalink.gmane.org/gmane.network.gnunet.devel/1363 */
   if (sq_prepare (dbh,
                   "SELECT size, type, prio, anonLevel, expire, hash, value, 
_ROWID_"
-                 " FROM gn070 WHERE _ROWID_ > :1 ORDER BY _ROWID_ ASC LIMIT 1",
+                  " FROM gn070 WHERE _ROWID_ > :1 ORDER BY _ROWID_ ASC LIMIT 
1",
                   &stmt) != SQLITE_OK)
     {
       LOG_SQLITE (handle,
@@ -853,37 +855,37 @@
     }
   count = 0;
   last_rowid = 0;
-  while (1) {
-    ret = sqlite3_bind_int64 (stmt,
-                             1,
-                             last_rowid);
-    if (ret != SQLITE_OK)
-      break;
-    if (sqlite3_step (stmt) != SQLITE_ROW)
-      break;
-    datum = assembleDatum (handle, stmt, &key, &rowid);
-    last_rowid = rowid;
-    sqlite3_reset(stmt);
-    if (datum == NULL) 
-      continue;        
-    payload += getContentDatastoreSize (datum);
-    if (iter != NULL)
-      ret = iter (&key, datum, closure, rowid);
-    else
-      ret = OK;
-    if (ret == SYSERR) 
-      {
-       FREE (datum);
-       count = SYSERR;
-       break;
-      }
-    if (ret == NO) {
-      payload -= getContentDatastoreSize (datum);
-      delete_by_rowid(handle, rowid);
-    }  
-    FREE (datum);
-    count++;
-  }
+  while (1)
+    {
+      ret = sqlite3_bind_int64 (stmt, 1, last_rowid);
+      if (ret != SQLITE_OK)
+        break;
+      if (sqlite3_step (stmt) != SQLITE_ROW)
+        break;
+      datum = assembleDatum (handle, stmt, &key, &rowid);
+      last_rowid = rowid;
+      sqlite3_reset (stmt);
+      if (datum == NULL)
+        continue;
+      payload += getContentDatastoreSize (datum);
+      if (iter != NULL)
+        ret = iter (&key, datum, closure, rowid);
+      else
+        ret = OK;
+      if (ret == SYSERR)
+        {
+          FREE (datum);
+          count = SYSERR;
+          break;
+        }
+      if (ret == NO)
+        {
+          payload -= getContentDatastoreSize (datum);
+          delete_by_rowid (handle, rowid);
+        }
+      FREE (datum);
+      count++;
+    }
   sqlite3_finalize (stmt);
   if (count != SYSERR)
     {
@@ -971,7 +973,7 @@
   int count = 0;
   sqlite3_stmt *stmt;
   char scratch[256];
-  Datastore_Value * datum;
+  Datastore_Value *datum;
   sqlite3 *dbh;
   sqliteHandle *handle;
   HashCode512 rkey;
@@ -979,14 +981,15 @@
   unsigned long long rowid;
 
   if (key == NULL)
-    return iterateLowPriority(type, iter, closure);
+    return iterateLowPriority (type, iter, closure);
   handle = getDBHandle ();
   dbh = handle->dbh;
   strcpy (scratch, "SELECT ");
   if (iter == NULL)
     strcat (scratch, "count(*)");
   else
-    strcat (scratch, "size, type, prio, anonLevel, expire, hash, value, 
_ROWID_");
+    strcat (scratch,
+            "size, type, prio, anonLevel, expire, hash, value, _ROWID_");
   strcat (scratch, " FROM gn070 WHERE hash = :1 AND _ROWID_ > :2");
   if (type)
     strcat (scratch, " AND type = :3");
@@ -999,53 +1002,54 @@
     }
   count = 0;
   last_rowid = 0;
-  while (1) {
-    ret = sqlite3_bind_blob (stmt,
-                            1,
-                            key, sizeof (HashCode512), SQLITE_TRANSIENT);
-    if (ret == SQLITE_OK)
-      ret = sqlite3_bind_int64 (stmt,
-                               2,
-                               last_rowid);
-    if (type && (ret == SQLITE_OK))
-      ret = sqlite3_bind_int (stmt, 3, type);   
-    if (ret == SQLITE_OK) {
-      ret = sqlite3_step (stmt);
-      if (ret != SQLITE_ROW)
-       break;
-      datum = assembleDatum (handle, stmt, &rkey, &rowid);
-      last_rowid = rowid;
-      sqlite3_reset(stmt);
-      if (datum == NULL) 
-       continue;      
-      if ((key != NULL) &&
-         (0 != memcmp (&rkey, key, sizeof (HashCode512))))
-       {
-         GE_BREAK (NULL, 0);
-         FREE (datum);
-         continue;
-       }      
-      if (iter != NULL)
-       ret = iter (&rkey, datum, closure, rowid);
-      else
-       ret = OK;
-      if (ret == SYSERR)
-       {
-         count = SYSERR;
-         FREE (datum);
-         ret = SQLITE_DONE;
-         break;
-       }
-      if (ret == NO) {
-       MUTEX_LOCK(db->DATABASE_Lock_);
-       db->payload -= getContentDatastoreSize (datum);
-       MUTEX_UNLOCK(db->DATABASE_Lock_);
-       delete_by_rowid(handle, rowid);
-      }
-      FREE (datum);
-      count++;
+  while (1)
+    {
+      ret = sqlite3_bind_blob (stmt,
+                               1,
+                               key, sizeof (HashCode512), SQLITE_TRANSIENT);
+      if (ret == SQLITE_OK)
+        ret = sqlite3_bind_int64 (stmt, 2, last_rowid);
+      if (type && (ret == SQLITE_OK))
+        ret = sqlite3_bind_int (stmt, 3, type);
+      if (ret == SQLITE_OK)
+        {
+          ret = sqlite3_step (stmt);
+          if (ret != SQLITE_ROW)
+            break;
+          datum = assembleDatum (handle, stmt, &rkey, &rowid);
+          last_rowid = rowid;
+          sqlite3_reset (stmt);
+          if (datum == NULL)
+            continue;
+          if ((key != NULL) &&
+              (0 != memcmp (&rkey, key, sizeof (HashCode512))))
+            {
+              GE_BREAK (NULL, 0);
+              FREE (datum);
+              continue;
+            }
+          if (iter != NULL)
+            ret = iter (&rkey, datum, closure, rowid);
+          else
+            ret = OK;
+          if (ret == SYSERR)
+            {
+              count = SYSERR;
+              FREE (datum);
+              ret = SQLITE_DONE;
+              break;
+            }
+          if (ret == NO)
+            {
+              MUTEX_LOCK (db->DATABASE_Lock_);
+              db->payload -= getContentDatastoreSize (datum);
+              MUTEX_UNLOCK (db->DATABASE_Lock_);
+              delete_by_rowid (handle, rowid);
+            }
+          FREE (datum);
+          count++;
+        }
     }
-  }
   sqlite3_finalize (stmt);
   return count;
 }
@@ -1126,8 +1130,7 @@
  * in the datastore.
  */
 static int
-update (unsigned long long uid,
-        int delta, cron_t expire)
+update (unsigned long long uid, int delta, cron_t expire)
 {
   int n;
   sqliteHandle *dbh;
@@ -1138,8 +1141,7 @@
   sqlite3_bind_int64 (dbh->updPrio, 3, uid);
   n = sqlite3_step (dbh->updPrio);
   if (n != SQLITE_DONE)
-    LOG_SQLITE (dbh,
-               GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_step");
+    LOG_SQLITE (dbh, GE_ERROR | GE_ADMIN | GE_USER | GE_BULK, "sqlite_step");
 
   sqlite3_reset (dbh->updPrio);
 

Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest.c 2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -53,7 +53,7 @@
 static int
 checkValue (const HashCode512 * key,
             const Datastore_Value * val, void *closure,
-           unsigned long long uid)
+            unsigned long long uid)
 {
   int i;
   int ret;
@@ -79,7 +79,7 @@
 
 static int
 iterateUp (const HashCode512 * key, const Datastore_Value * val, int *closure,
-          unsigned long long uid)
+           unsigned long long uid)
 {
   int ret;
 
@@ -91,7 +91,7 @@
 static int
 iterateDown (const HashCode512 * key,
              const Datastore_Value * val, int *closure,
-            unsigned long long uid)
+             unsigned long long uid)
 {
   int ret;
 
@@ -102,25 +102,25 @@
 
 static int
 iterateDelete (const HashCode512 * key,
-               const Datastore_Value * val, void * closure,
-              unsigned long long uid)
+               const Datastore_Value * val, void *closure,
+               unsigned long long uid)
 {
   return NO;
 }
 
 static int
 iteratePriority (const HashCode512 * key,
-                const Datastore_Value * val, SQstore_ServiceAPI * api,
-                unsigned long long uid)
+                 const Datastore_Value * val, SQstore_ServiceAPI * api,
+                 unsigned long long uid)
 {
-  api->update(uid, 4, 0);
+  api->update (uid, 4, 0);
   return OK;
 }
 
 static int
 priorityCheck (const HashCode512 * key,
                const Datastore_Value * val, int *closure,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   int id;
 
@@ -134,7 +134,7 @@
 static int
 multipleCheck (const HashCode512 * key,
                const Datastore_Value * val, Datastore_Value ** last,
-              unsigned long long uid)
+               unsigned long long uid)
 {
   if (*last != NULL)
     {
@@ -209,8 +209,7 @@
   ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
                                            (Datum_Iterator) & priorityCheck,
                                            &i));
-  ASSERT (1 == api->iterateAllNow((Datum_Iterator) & iteratePriority,
-                                 api));
+  ASSERT (1 == api->iterateAllNow ((Datum_Iterator) & iteratePriority, api));
   i += 4;
   ASSERT (1 == api->iterateExpirationTime (ANY_BLOCK,
                                            (Datum_Iterator) & priorityCheck,
@@ -227,8 +226,7 @@
                                            (Datum_Iterator) & multipleCheck,
                                            &value));
   FREE (value);
-  ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete,
-                                  api));
+  ASSERT (2 == api->iterateAllNow ((Datum_Iterator) & iterateDelete, api));
   ASSERT (0 == api->iterateExpirationTime (ANY_BLOCK, NULL, NULL));
   api->drop ();
 

Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2007-07-22 
08:20:14 UTC (rev 5339)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest2.c        2007-07-22 
08:25:48 UTC (rev 5340)
@@ -166,8 +166,7 @@
 
 static int
 iterateDelete (const HashCode512 * key,
-               const Datastore_Value * val, void *cls,
-              unsigned long long uid)
+               const Datastore_Value * val, void *cls, unsigned long long uid)
 {
   SQstore_ServiceAPI *api = cls;
   static int dc;

Modified: GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c
===================================================================
--- GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c        2007-07-22 
08:20:14 UTC (rev 5339)
+++ GNUnet/src/applications/sqstore_sqlite/sqlitetest3.c        2007-07-22 
08:25:48 UTC (rev 5340)
@@ -71,7 +71,7 @@
   size = size - (size & 7);     /* always multiple of 8 */
 
   /* generate random key */
-  key.bits[0] = (unsigned int) get_time();
+  key.bits[0] = (unsigned int) get_time ();
   hash (&key, sizeof (HashCode512), &key);
   value = MALLOC (size);
   value->size = htonl (size);
@@ -97,7 +97,7 @@
 
 static int
 iterateDummy (const HashCode512 * key, const Datastore_Value * val, void *cls,
-             unsigned long long uid)
+              unsigned long long uid)
 {
   if (GNUNET_SHUTDOWN_TEST () == YES)
     return SYSERR;
@@ -131,35 +131,40 @@
       start = get_time ();
       ret = api->iterateLowPriority (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u low priority iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u low priority iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateExpirationTime (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u expiration t iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u expiration t iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateNonAnonymous (0, &iterateDummy, api);
       end = get_time ();
-      printf ("%3u non anonymou iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u non anonymou iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateMigrationOrder (&iterateDummy, api);
       end = get_time ();
-      printf ("%3u migration or iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u migration or iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
       start = get_time ();
       ret = api->iterateAllNow (&iterateDummy, api);
       end = get_time ();
-      printf ("%3u all now      iteration took %20llums (%d)\n", i, end - 
start, ret);
+      printf ("%3u all now      iteration took %20llums (%d)\n", i,
+              end - start, ret);
       if (GNUNET_SHUTDOWN_TEST () == YES)
         break;
     }
-  api->drop();
+  api->drop ();
   return OK;
 }
 

Modified: GNUnet/src/applications/transport/check.c
===================================================================
--- GNUnet/src/applications/transport/check.c   2007-07-22 08:20:14 UTC (rev 
5339)
+++ GNUnet/src/applications/transport/check.c   2007-07-22 08:25:48 UTC (rev 
5340)
@@ -49,14 +49,15 @@
 
 } TCPSession;
 
-static void check(TSession * session) {
-  TCPSession * tcp;
+static void
+check (TSession * session)
+{
+  TCPSession *tcp;
 
   if (session->ttype != TCP_PROTOCOL_NUMBER)
     return;
   tcp = session->internal;
-  GE_ASSERT(NULL,
-           tcp->users >= session->token_count);
+  GE_ASSERT (NULL, tcp->users >= session->token_count);
 }
 
 #define CHECK(s) check(s)

Modified: GNUnet/src/applications/transport/transport.c
===================================================================
--- GNUnet/src/applications/transport/transport.c       2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/applications/transport/transport.c       2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -92,7 +92,7 @@
     }
   if (i != -1)
     {
-      GE_BREAK(NULL, 0);
+      GE_BREAK (NULL, 0);
       MUTEX_UNLOCK (lock);
       return SYSERR;
     }
@@ -243,15 +243,14 @@
       return NULL;
     }
   tsession = NULL;
-  if (OK != tapis[prot]->connect (hello, &tsession)) 
-    return NULL;  
+  if (OK != tapis[prot]->connect (hello, &tsession))
+    return NULL;
   tsession->ttype = prot;
   MUTEX_LOCK (lock);
   APPEND (tsession->tokens, tsession->token_count, token);
-  CHECK(tsession);
+  CHECK (tsession);
   MUTEX_UNLOCK (lock);
-  GE_BREAK(NULL,
-          OK == assertAssociated(tsession, token));
+  GE_BREAK (NULL, OK == assertAssociated (tsession, token));
   return tsession;
 }
 
@@ -282,7 +281,7 @@
       ret = transportConnect (hello, token);
       FREE (hello);
       if (ret != NULL)
-          break;
+        break;
     }
   FREE (perm);
   if (ret == NULL)
@@ -320,14 +319,13 @@
     return SYSERR;
   ret = tapis[tsession->ttype]->associate (tsession);
   MUTEX_LOCK (lock);
-  if (ret == OK)    
-      APPEND (tsession->tokens, tsession->token_count, token);    
-  CHECK(tsession);
+  if (ret == OK)
+    APPEND (tsession->tokens, tsession->token_count, token);
+  CHECK (tsession);
   MUTEX_UNLOCK (lock);
   if (ret == OK)
-    GE_BREAK(NULL,
-            OK == assertAssociated(tsession, token));
-   return ret;
+    GE_BREAK (NULL, OK == assertAssociated (tsession, token));
+  return ret;
 }
 
 /**
@@ -363,7 +361,7 @@
                                    that call core with TSession being NULL. */
     }
   MUTEX_LOCK (lock);
-  CHECK(tsession);
+  CHECK (tsession);
   MUTEX_UNLOCK (lock);
   if ((tsession->ttype >= tapis_count) || (tapis[tsession->ttype] == NULL))
     {
@@ -396,7 +394,7 @@
       return SYSERR;
     }
   MUTEX_LOCK (lock);
-  CHECK(tsession);
+  CHECK (tsession);
   for (i = 0; i < tsession->token_count; i++)
     {
       if (0 == strcmp (tsession->tokens[i], token))
@@ -420,7 +418,7 @@
     }
   MUTEX_UNLOCK (lock);
   i = tapis[tsession->ttype]->disconnect (tsession);
-  GE_BREAK(NULL, i == OK); /* should never fail */
+  GE_BREAK (NULL, i == OK);     /* should never fail */
   return i;
 }
 

Modified: GNUnet/src/include/gnunet_datastore_service.h
===================================================================
--- GNUnet/src/include/gnunet_datastore_service.h       2007-07-22 08:20:14 UTC 
(rev 5339)
+++ GNUnet/src/include/gnunet_datastore_service.h       2007-07-22 08:25:48 UTC 
(rev 5340)
@@ -96,7 +96,7 @@
  */
 typedef int (*Datum_Iterator) (const HashCode512 * key,
                                const Datastore_Value * value, void *closure,
-                              unsigned long long uid);
+                               unsigned long long uid);
 
 
 /**
@@ -189,8 +189,7 @@
   /**
    * Explicitly remove some content from the database.
    */
-  int
-  (*del)(const HashCode512 * query, const Datastore_Value * value);
+  int (*del) (const HashCode512 * query, const Datastore_Value * value);
 
 } Datastore_ServiceAPI;
 

Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c      2007-07-22 08:20:14 UTC (rev 5339)
+++ GNUnet/src/server/connection.c      2007-07-22 08:25:48 UTC (rev 5340)
@@ -643,7 +643,9 @@
 
 /* ******************** CODE ********************* */
 
-static void check_invariants() {
+static void
+check_invariants ()
+{
   int i;
   BufferEntry *root;
 
@@ -654,12 +656,14 @@
       while (NULL != root)
         {
           if (root->session.tsession != NULL)
-           GE_ASSERT(NULL,
-                     OK == transport->assertAssociated(root->session.tsession, 
__FILE__));
-         root = root->overflowChain;
-       }
+            GE_ASSERT (NULL,
+                       OK ==
+                       transport->assertAssociated (root->session.tsession,
+                                                    __FILE__));
+          root = root->overflowChain;
+        }
     }
-  MUTEX_UNLOCK(lock);      
+  MUTEX_UNLOCK (lock);
 }
 
 /**
@@ -2554,7 +2558,7 @@
   int load_nup;
   int load_cpu;
 
-  ENTRY();
+  ENTRY ();
   load_cpu = os_cpu_get_load (ectx, cfg);
   load_nup = os_network_monitor_get_load (load_monitor, Upload);
   scheduleInboundTraffic ();
@@ -2700,7 +2704,7 @@
       stats->set (stat_total_allowed_now, total_allowed_now);
       stats->set (stat_total_send_buffer_size, total_send_buffer_size);
     }
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -2738,7 +2742,7 @@
       GE_LOG (ectx,
               GE_WARNING | GE_BULK | GE_DEVELOPER,
               _("Message from `%s' discarded: invalid format.\n"), &enc);
-      EXIT();
+      EXIT ();
       return SYSERR;
     }
   if (stats != NULL)
@@ -2748,10 +2752,11 @@
   if (equalsHashCode512 (&hc,
                          &msg->hash) &&
       (msg->sequenceNumber == 0) &&
-      (msg->bandwidth == 0) && (msg->timeStamp == 0)) {
-    EXIT();
-    return NO;                  /* plaintext */
-  }
+      (msg->bandwidth == 0) && (msg->timeStamp == 0))
+    {
+      EXIT ();
+      return NO;                /* plaintext */
+    }
 
   MUTEX_LOCK (lock);
   be = lookForHost (sender);
@@ -2772,7 +2777,7 @@
       if ((be == NULL) || (be->status == STAT_DOWN))
         addHost (sender, YES);
       MUTEX_UNLOCK (lock);
-      EXIT();
+      EXIT ();
       return SYSERR;            /* could not decrypt */
     }
   tmp = MALLOC (size - sizeof (HashCode512));
@@ -2793,7 +2798,7 @@
       addHost (sender, YES);
       MUTEX_UNLOCK (lock);
       FREE (tmp);
-      EXIT();
+      EXIT ();
       return SYSERR;
     }
   if (stats != NULL)
@@ -2826,7 +2831,7 @@
                   sequenceNumber, be->lastSequenceNumberReceived);
 #endif
           MUTEX_UNLOCK (lock);
-         EXIT();
+          EXIT ();
           return SYSERR;
         }
     }
@@ -2846,7 +2851,7 @@
               _("Message received more than one day old. Dropped.\n"));
 #endif
       MUTEX_UNLOCK (lock);
-      EXIT();
+      EXIT ();
       return SYSERR;
     }
 
@@ -2862,7 +2867,7 @@
     }
   be->recently_received += size;
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return YES;
 }
 
@@ -2929,7 +2934,7 @@
 {
   BufferEntry *be;
 
-  ENTRY();
+  ENTRY ();
   MUTEX_LOCK (lock);
   be = lookForHost (peer);
   if (be == NULL)
@@ -2959,7 +2964,7 @@
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -2972,7 +2977,7 @@
 {
   BufferEntry *be;
 
-  ENTRY();
+  ENTRY ();
   MUTEX_LOCK (lock);
   be = lookForHost (peer);
   if (be != NULL)
@@ -2999,7 +3004,7 @@
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 
@@ -3024,7 +3029,7 @@
   BufferEntry *be;
   int ret;
 
-  ENTRY();
+  ENTRY ();
   ret = 0;
   MUTEX_LOCK (lock);
   if ((slot >= 0) && (slot < CONNECTION_MAX_HOSTS_))
@@ -3038,7 +3043,7 @@
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3054,7 +3059,7 @@
   int ret;
   BufferEntry *be;
 
-  ENTRY();
+  ENTRY ();
   ret = 0;
   MUTEX_LOCK (lock);
   be = lookForHost (peer);
@@ -3069,7 +3074,7 @@
       ret = SYSERR;
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3091,7 +3096,7 @@
   int ret;
   BufferEntry *be;
 
-  ENTRY();
+  ENTRY ();
   ret = SYSERR;
   MUTEX_LOCK (lock);
   be = lookForHost (peer);
@@ -3117,7 +3122,7 @@
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3155,7 +3160,7 @@
   if (be == NULL)
     {
       MUTEX_UNLOCK (lock);
-      EXIT();
+      EXIT ();
       return;
     }
   cost = -1;
@@ -3175,8 +3180,8 @@
   if ((transport->getCost (tsession->ttype) < cost) &&
       (OK == transport->associate (tsession, __FILE__)))
     {
-      GE_ASSERT(NULL,
-               OK == transport->assertAssociated(tsession, __FILE__));
+      GE_ASSERT (NULL,
+                 OK == transport->assertAssociated (tsession, __FILE__));
       ts = be->session.tsession;
       if (ts != NULL)
         {
@@ -3185,12 +3190,12 @@
         }
       be->session.tsession = tsession;
       be->session.mtu = transport->getMTU (tsession->ttype);
-      check_invariants();
+      check_invariants ();
       fragmentIfNecessary (be);
     }
-  EXIT();
+  EXIT ();
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 
@@ -3372,7 +3377,7 @@
                 ("# total number of bytes we are currently allowed to send"));
     }
   transport->start (&core_receive);
-  EXIT();
+  EXIT ();
 }
 
 
@@ -3442,7 +3447,7 @@
   ectx = NULL;
   cfg = NULL;
   load_monitor = NULL;
-  EXIT();
+  EXIT ();
 }
 
 
@@ -3460,13 +3465,13 @@
   fENHWrap wrap;
   int ret;
 
-  ENTRY();
+  ENTRY ();
   wrap.method = method;
   wrap.arg = arg;
   MUTEX_LOCK (lock);
   ret = forAllConnectedHosts (&fENHCallback, &wrap);
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3564,7 +3569,7 @@
       scl_nextTail = scl;
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return OK;
 }
 
@@ -3588,7 +3593,7 @@
   SendCallbackList *pos;
   SendCallbackList *prev;
 
-  ENTRY();
+  ENTRY ();
   prev = NULL;
   MUTEX_LOCK (lock);
   pos = scl_nextHead;
@@ -3605,14 +3610,14 @@
             scl_nextTail = prev;
           FREE (pos);
           MUTEX_UNLOCK (lock);
-         EXIT();
+          EXIT ();
           return OK;
         }
       prev = pos;
       pos = pos->next;
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return SYSERR;
 }
 
@@ -3635,7 +3640,7 @@
   int ret;
   P2P_PACKET_HEADER *hdr;
 
-  ENTRY();
+  ENTRY ();
   GE_ASSERT (ectx, tsession != NULL);
   if ((transport->getMTU (tsession->ttype) > 0) &&
       (transport->getMTU (tsession->ttype) <
@@ -3655,7 +3660,7 @@
   ret = transport->send (tsession,
                          buf, size + sizeof (P2P_PACKET_HEADER), NO);
   FREE (buf);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3701,7 +3706,7 @@
       FREENONNULL (closure);
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -3721,27 +3726,28 @@
   char *closure;
   unsigned short len;
 
-  ENTRY();
+  ENTRY ();
   if ((getBandwidthAssignedTo (receiver, NULL, NULL) != OK) &&
       (identity->isBlacklistedStrict (receiver) == NO))
     session->tryConnect (receiver);
-  if (msg == NULL) {
-    EXIT();
-    return;
-  }
+  if (msg == NULL)
+    {
+      EXIT ();
+      return;
+    }
   len = ntohs (msg->size);
   if (len == 0)
     {
       GE_LOG (ectx,
               GE_DEBUG | GE_BULK | GE_DEVELOPER,
               "Empty message send (hopefully used to initiate connection 
attempt)\n");
-      EXIT();
+      EXIT ();
       return;
     }
   closure = MALLOC (len);
   memcpy (closure, msg, len);
   unicastCallback (receiver, NULL, closure, len, importance, maxdelay);
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -3754,10 +3760,10 @@
 computeIndex (const PeerIdentity * hostId)
 {
   unsigned int res;
-  
-  ENTRY();
+
+  ENTRY ();
   res = (((unsigned int) hostId->hashPubKey.bits[0]) &
-        ((unsigned int) (CONNECTION_MAX_HOSTS_ - 1)));
+         ((unsigned int) (CONNECTION_MAX_HOSTS_ - 1)));
   GE_ASSERT (ectx, res < CONNECTION_MAX_HOSTS_);
   return res;
 }
@@ -3797,7 +3803,7 @@
       ret = SYSERR;
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return ret;
 }
 
@@ -3817,7 +3823,7 @@
   if (be != NULL)
     be->current_connection_value += preference;
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -3853,7 +3859,7 @@
       shutdownConnection (be);
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
 }
 
 /**
@@ -3869,12 +3875,12 @@
 {
   if (callback == NULL)
     return SYSERR;
-  ENTRY();
+  ENTRY ();
   MUTEX_LOCK (lock);
   GROW (rsns, rsnSize, rsnSize + 1);
   rsns[rsnSize - 1] = callback;
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return OK;
 }
 
@@ -3893,7 +3899,7 @@
 
   if (callback == NULL)
     return OK;
-  ENTRY();
+  ENTRY ();
   MUTEX_LOCK (lock);
   for (i = 0; i < rsnSize; i++)
     {
@@ -3906,7 +3912,7 @@
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return SYSERR;
 }
 
@@ -3922,7 +3928,7 @@
   int i;
   BufferEntry *root;
 
-  ENTRY();
+  ENTRY ();
   MUTEX_LOCK (lock);
   for (i = 0; i < CONNECTION_MAX_HOSTS_; i++)
     {
@@ -3933,14 +3939,14 @@
             {
               GE_BREAK (ectx, 0);
               MUTEX_UNLOCK (lock);
-             EXIT();
+              EXIT ();
               return SYSERR;
             }
           root = root->overflowChain;
         }
     }
   MUTEX_UNLOCK (lock);
-  EXIT();
+  EXIT ();
   return OK;
 }
 

Modified: GNUnet/src/transports/tcp_helper.c
===================================================================
--- GNUnet/src/transports/tcp_helper.c  2007-07-22 08:20:14 UTC (rev 5339)
+++ GNUnet/src/transports/tcp_helper.c  2007-07-22 08:25:48 UTC (rev 5340)
@@ -143,8 +143,7 @@
       pos = pos->next;
     }
   MUTEX_UNLOCK (tcplock);
-  GE_ASSERT(ectx,
-           OK == coreAPI->assertUnused (tcpsession->tsession));
+  GE_ASSERT (ectx, OK == coreAPI->assertUnused (tcpsession->tsession));
   MUTEX_LOCK (tcplock);
   FREE (tcpsession->tsession);
   FREE (tcpsession);
@@ -163,8 +162,7 @@
   if ((tcpsession->users > 0) || (tcpsession->in_select == YES))
     {
       if (tcpsession->users == 0)
-       select_change_timeout (selector, tcpsession->sock,
-                              TCP_FAST_TIMEOUT);        
+        select_change_timeout (selector, tcpsession->sock, TCP_FAST_TIMEOUT);
       MUTEX_UNLOCK (tcpsession->lock);
       MUTEX_UNLOCK (tcplock);
       return OK;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]