[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8088 - in GNUnet/src: applications/datastore applications/
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8088 - in GNUnet/src: applications/datastore applications/fs/collection applications/fs/ecrs applications/fs/fsui applications/fs/tools applications/sqstore_mysql applications/sqstore_postgres applications/testing intlemu server setup/cocoa setup/gtk setup/lib setup/ncurses transports |
Date: |
Sat, 3 Jan 2009 03:10:25 -0700 (MST) |
Author: grothoff
Date: 2009-01-03 03:10:25 -0700 (Sat, 03 Jan 2009)
New Revision: 8088
Modified:
GNUnet/src/applications/datastore/datastore.c
GNUnet/src/applications/fs/collection/collection.c
GNUnet/src/applications/fs/ecrs/namespace.c
GNUnet/src/applications/fs/fsui/fsui.c
GNUnet/src/applications/fs/tools/gnunet-unindex.c
GNUnet/src/applications/sqstore_mysql/mysqltest3.c
GNUnet/src/applications/sqstore_postgres/postgres.c
GNUnet/src/applications/sqstore_postgres/postgres_test2.c
GNUnet/src/applications/testing/remote.c
GNUnet/src/applications/testing/remotetopologies.c
GNUnet/src/applications/testing/testing.c
GNUnet/src/intlemu/intlemu.c
GNUnet/src/intlemu/libintlemu.h
GNUnet/src/server/connection.c
GNUnet/src/setup/cocoa/GNUNETSetupView.h
GNUnet/src/setup/gtk/wizard_gtk.c
GNUnet/src/setup/lib/gns.c
GNUnet/src/setup/ncurses/mconf.c
GNUnet/src/transports/http.c
Log:
indent
Modified: GNUnet/src/applications/datastore/datastore.c
===================================================================
--- GNUnet/src/applications/datastore/datastore.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/datastore/datastore.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -402,9 +402,9 @@
stat_filter_failed =
stats->create (gettext_noop ("# bloom filter false positives"));
- stats->set (stats->
- create (gettext_noop ("# bytes allowed in datastore")),
- quota);
+ stats->
+ set (stats->create (gettext_noop ("# bytes allowed in datastore")),
+ quota);
}
state = capi->service_request ("state");
if (state != NULL)
Modified: GNUnet/src/applications/fs/collection/collection.c
===================================================================
--- GNUnet/src/applications/fs/collection/collection.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/fs/collection/collection.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -520,12 +520,9 @@
GNUNET_OK == GNUNET_ECRS_directory_create (ectx,
&dirData,
&dirLen,
- collectionData->
- file_count,
- collectionData->
- files,
- collectionData->
- meta));
+
collectionData->file_count,
+
collectionData->files,
+
collectionData->meta));
if (-1 == WRITE (fd, dirData, dirLen))
{
GNUNET_GE_LOG_STRERROR (ectx,
@@ -539,10 +536,10 @@
GNUNET_free (dirData);
CLOSE (fd);
if (GNUNET_OK != GNUNET_ECRS_file_upload (ectx, cfg, tmpName, GNUNET_NO,
/* indexing */
- ntohl (collectionData->data.
- anonymityLevel),
- ntohl (collectionData->data.
- priority),
+ ntohl (collectionData->
+ data.anonymityLevel),
+ ntohl (collectionData->
+ data.priority),
GNUNET_get_time () +
COLLECTION_ADV_LIFETIME, NULL,
NULL, NULL, NULL, &directoryURI))
@@ -567,10 +564,10 @@
uri = GNUNET_ECRS_namespace_add_content (ectx,
cfg,
&collectionData->data.pid,
- ntohl (collectionData->data.
- anonymityLevel),
- ntohl (collectionData->data.
- priority),
+ ntohl (collectionData->
+ data.anonymityLevel),
+ ntohl (collectionData->
+ data.priority),
GNUNET_get_time () +
COLLECTION_ADV_LIFETIME,
this_revision_string,
Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2009-01-03 10:02:44 UTC (rev
8087)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2009-01-03 10:10:25 UTC (rev
8088)
@@ -309,8 +309,8 @@
sizeof (unsigned
int),
&ksb->sblock,
- &ksb->kblock.
- signature));
+ &ksb->
+ kblock.signature));
/* extra check: verify sig */
GNUNET_RSA_free_key (pk);
if (GNUNET_OK != GNUNET_FS_insert (sock, knvalue))
Modified: GNUnet/src/applications/fs/fsui/fsui.c
===================================================================
--- GNUnet/src/applications/fs/fsui/fsui.c 2009-01-03 10:02:44 UTC (rev
8087)
+++ GNUnet/src/applications/fs/fsui/fsui.c 2009-01-03 10:10:25 UTC (rev
8088)
@@ -338,17 +338,19 @@
if (pos->mandatoryMatchesRemaining == 0)
{
- ((GNUNET_ECRS_FileInfo *) event->data.SearchResumed.fis)[event->
-
data.SearchResumed.fisSize]
- = pos->fi;
- event->data.SearchResumed.availability_rank[event->data.
- SearchResumed.fisSize] =
+ ((GNUNET_ECRS_FileInfo *) event->data.SearchResumed.fis)[event->data.
+ SearchResumed.
+ fisSize] =
+ pos->fi;
+ event->data.SearchResumed.availability_rank[event->data.SearchResumed.
+ fisSize] =
pos->probeSuccess - pos->probeFailure;
- event->data.SearchResumed.availability_certainty[event->
-
data.SearchResumed.fisSize]
- = pos->probeSuccess + pos->probeFailure;
- event->data.SearchResumed.applicability_rank[event->data.
- SearchResumed.fisSize] =
+ event->data.SearchResumed.availability_certainty[event->data.
+ SearchResumed.
+ fisSize] =
+ pos->probeSuccess + pos->probeFailure;
+ event->data.SearchResumed.applicability_rank[event->data.SearchResumed.
+ fisSize] =
pos->matchingSearchCount;
event->data.SearchResumed.fisSize++;
}
Modified: GNUnet/src/applications/fs/tools/gnunet-unindex.c
===================================================================
--- GNUnet/src/applications/fs/tools/gnunet-unindex.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/fs/tools/gnunet-unindex.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -75,9 +75,9 @@
event->data.UnindexCompleted.total,
delta / GNUNET_CRON_SECONDS,
(delta ==
- 0) ? (double) (-1.0) : (double) (event->data.
- UnindexCompleted.total /
- 1024.0 *
+ 0) ? (double) (-1.0) : (double) (event->
+ data.UnindexCompleted.
+ total / 1024.0 *
GNUNET_CRON_SECONDS /
delta));
}
Modified: GNUnet/src/applications/sqstore_mysql/mysqltest3.c
===================================================================
--- GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/sqstore_mysql/mysqltest3.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -69,11 +69,11 @@
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 32 * 1024);
size = size - (size & 7); /* always multiple of 8 */
if (size == 0)
- size = 8; /* never zero */
+ size = 8; /* never zero */
/* generate random key */
key.bits[0] = (unsigned int) GNUNET_get_time ();
GNUNET_hash (&key, sizeof (GNUNET_HashCode), &key);
- value = GNUNET_malloc (size );
+ value = GNUNET_malloc (size);
value->size = htonl (size);
value->type = htonl (i);
value->priority =
Modified: GNUnet/src/applications/sqstore_postgres/postgres.c
===================================================================
--- GNUnet/src/applications/sqstore_postgres/postgres.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/sqstore_postgres/postgres.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -113,28 +113,24 @@
*/
static int
check_result (PGresult * ret,
- int expected_status,
- const char * command,
- const char * args,
- int line)
+ int expected_status,
+ const char *command, const char *args, int line)
{
if (ret == NULL)
- {
- GNUNET_GE_LOG(coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
- "Postgres failed to allocate result for `%s:%s' at %d\n",
- command,
- args,
- line);
+ {
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
+ "Postgres failed to allocate result for `%s:%s' at %d\n",
+ command, args, line);
return GNUNET_SYSERR;
}
- if (PQresultStatus (ret) != expected_status)
+ if (PQresultStatus (ret) != expected_status)
{
- GNUNET_GE_LOG(coreAPI->ectx,
- GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
- _("`%s:%s' failed at %s:%d with error: %s"),
- command, args, __FILE__, line, PQerrorMessage(dbh));
- PQclear(ret);
+ GNUNET_GE_LOG (coreAPI->ectx,
+ GNUNET_GE_ERROR | GNUNET_GE_ADMIN | GNUNET_GE_BULK,
+ _("`%s:%s' failed at %s:%d with error: %s"),
+ command, args, __FILE__, line, PQerrorMessage (dbh));
+ PQclear (ret);
return GNUNET_SYSERR;
}
return GNUNET_OK;
@@ -144,13 +140,13 @@
* Run simple SQL statement (without results).
*/
static int
-pq_exec (const char * sql, int line)
+pq_exec (const char *sql, int line)
{
- PGresult * ret;
+ PGresult *ret;
ret = PQexec (dbh, sql);
if (GNUNET_OK != check_result (ret, PGRES_COMMAND_OK, "PQexec", sql, line))
- return GNUNET_SYSERR;
- PQclear(ret);
+ return GNUNET_SYSERR;
+ PQclear (ret);
return GNUNET_OK;
}
@@ -158,16 +154,14 @@
* Prepare SQL statement.
*/
static int
-pq_prepare (const char * name,
- const char * sql,
- int nparms,
- int line)
+pq_prepare (const char *name, const char *sql, int nparms, int line)
{
- PGresult * ret;
+ PGresult *ret;
ret = PQprepare (dbh, name, sql, nparms, NULL);
- if (GNUNET_OK != check_result (ret, PGRES_COMMAND_OK, "PQprepare", sql,
line))
- return GNUNET_SYSERR;
- PQclear(ret);
+ if (GNUNET_OK !=
+ check_result (ret, PGRES_COMMAND_OK, "PQprepare", sql, line))
+ return GNUNET_SYSERR;
+ PQclear (ret);
return GNUNET_OK;
}
@@ -178,23 +172,22 @@
static int
init_connection ()
{
- char * conninfo;
- PGresult * ret;
+ char *conninfo;
+ PGresult *ret;
/* Open database and precompile statements */
conninfo = NULL;
GNUNET_GC_get_configuration_value_string (coreAPI->cfg,
- "POSTGRES", "CONFIG",
- "connect_timeout=10",
- &conninfo);
- dbh = PQconnectdb(conninfo);
+ "POSTGRES", "CONFIG",
+ "connect_timeout=10", &conninfo);
+ dbh = PQconnectdb (conninfo);
GNUNET_free (conninfo);
if (dbh == NULL)
{
/* FIXME: warn about out-of-memory? */
return GNUNET_SYSERR;
}
- if (PQstatus(dbh) != CONNECTION_OK)
+ if (PQstatus (dbh) != CONNECTION_OK)
{
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_ERROR | GNUNET_GE_BULK | GNUNET_GE_USER,
@@ -205,123 +198,124 @@
return GNUNET_SYSERR;
}
- ret = PQexec (dbh,
- "CREATE TABLE gn080 ("
- " size INTEGER NOT NULL DEFAULT 0,"
- " type INTEGER NOT NULL DEFAULT 0,"
- " prio INTEGER NOT NULL DEFAULT 0,"
- " anonLevel INTEGER NOT NULL DEFAULT 0,"
- " expire BIGINT NOT NULL DEFAULT 0,"
- " hash BYTEA NOT NULL DEFAULT '',"
- " vhash BYTEA NOT NULL DEFAULT '',"
- " value BYTEA NOT NULL DEFAULT '')"
- "WITH OIDS");
- if ( (ret == NULL) ||
- ( (PQresultStatus (ret) != PGRES_COMMAND_OK) &&
- (0 != strcmp("42P07", /* duplicate table */
- PQresultErrorField (ret, PG_DIAG_SQLSTATE))) ) )
+ ret = PQexec (dbh,
+ "CREATE TABLE gn080 ("
+ " size INTEGER NOT NULL DEFAULT 0,"
+ " type INTEGER NOT NULL DEFAULT 0,"
+ " prio INTEGER NOT NULL DEFAULT 0,"
+ " anonLevel INTEGER NOT NULL DEFAULT 0,"
+ " expire BIGINT NOT NULL DEFAULT 0,"
+ " hash BYTEA NOT NULL DEFAULT '',"
+ " vhash BYTEA NOT NULL DEFAULT '',"
+ " value BYTEA NOT NULL DEFAULT '')" "WITH OIDS");
+ if ((ret == NULL) || ((PQresultStatus (ret) != PGRES_COMMAND_OK) && (0 !=
strcmp ("42P07", /* duplicate table */
+
PQresultErrorField
+
(ret,
+
PG_DIAG_SQLSTATE)))))
{
check_result (ret, PGRES_COMMAND_OK, "CREATE TABLE", "gn080", __LINE__);
PQfinish (dbh);
dbh = NULL;
return GNUNET_SYSERR;
}
- if (PQresultStatus (ret) == PGRES_COMMAND_OK)
+ if (PQresultStatus (ret) == PGRES_COMMAND_OK)
{
- if ( (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_hash ON gn080 (hash)", __LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_hash_vhash ON gn080 (hash,vhash)",
__LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_prio ON gn080 (prio)", __LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_expire ON gn080 (expire)", __LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_comb3 ON gn080 (prio,anonLevel)",
__LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_comb4 ON gn080 (prio,hash,anonLevel)",
__LINE__)) ||
- (GNUNET_OK !=
- pq_exec ("CREATE INDEX idx_comb7 ON gn080 (expire,hash)",
__LINE__)) )
- {
- PQclear(ret);
- PQfinish (dbh);
- dbh = NULL;
- return GNUNET_SYSERR;
- }
+ if ((GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_hash ON gn080 (hash)", __LINE__)) ||
+ (GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_hash_vhash ON gn080 (hash,vhash)",
+ __LINE__))
+ || (GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_prio ON gn080 (prio)", __LINE__))
+ || (GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_expire ON gn080 (expire)", __LINE__))
+ || (GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_comb3 ON gn080 (prio,anonLevel)",
+ __LINE__))
+ || (GNUNET_OK !=
+ pq_exec
+ ("CREATE INDEX idx_comb4 ON gn080 (prio,hash,anonLevel)",
+ __LINE__))
+ || (GNUNET_OK !=
+ pq_exec ("CREATE INDEX idx_comb7 ON gn080 (expire,hash)",
+ __LINE__)))
+ {
+ PQclear (ret);
+ PQfinish (dbh);
+ dbh = NULL;
+ return GNUNET_SYSERR;
+ }
}
- PQclear(ret);
- if ( (GNUNET_OK !=
- pq_prepare("getvt",
- "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
- "WHERE hash=$1 AND vhash=$2 AND type=$3 "
- "AND oid >= $4 ORDER BY oid ASC LIMIT 1 OFFSET $5",
- 5,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("gett",
- "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
- "WHERE hash=$1 AND type=$2"
- "AND oid >= $3 ORDER BY oid ASC LIMIT 1 OFFSET $4",
- 4,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("getv",
- "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
- "WHERE hash=$1 AND vhash=$2"
- "AND oid >= $3 ORDER BY oid ASC LIMIT 1 OFFSET $4",
- 4,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("get",
- "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
- "WHERE hash=$1"
- "AND oid >= $2 ORDER BY oid ASC LIMIT 1 OFFSET $3",
- 3,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("put",
- "INSERT INTO gn080 (size, type, prio, anonLevel, expire,
hash, vhash, value) "
- "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
- 8,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("update",
+ PQclear (ret);
+ if ((GNUNET_OK !=
+ pq_prepare ("getvt",
+ "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
+ "WHERE hash=$1 AND vhash=$2 AND type=$3 "
+ "AND oid >= $4 ORDER BY oid ASC LIMIT 1 OFFSET $5",
+ 5,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("gett",
+ "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
+ "WHERE hash=$1 AND type=$2"
+ "AND oid >= $3 ORDER BY oid ASC LIMIT 1 OFFSET $4",
+ 4,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("getv",
+ "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
+ "WHERE hash=$1 AND vhash=$2"
+ "AND oid >= $3 ORDER BY oid ASC LIMIT 1 OFFSET $4",
+ 4,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("get",
+ "SELECT size, type, prio, anonLevel, expire, hash, value,
oid FROM gn080 "
+ "WHERE hash=$1"
+ "AND oid >= $2 ORDER BY oid ASC LIMIT 1 OFFSET $3",
+ 3,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("put",
+ "INSERT INTO gn080 (size, type, prio, anonLevel, expire,
hash, vhash, value) "
+ "VALUES ($1, $2, $3, $4, $5, $6, $7, $8)",
+ 8,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("update",
"UPDATE gn080 SET prio = prio + $1, expire = CASE WHEN
expire < $2 THEN $2 ELSE expire END "
- "WHERE oid = $3",
- 3,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("select_low_priority",
+ "WHERE oid = $3",
+ 3,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("select_low_priority",
SELECT_IT_LOW_PRIORITY,
- 2,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("select_non_anonymous",
+ 2,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("select_non_anonymous",
SELECT_IT_NON_ANONYMOUS,
- 2,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("select_expiration_time",
+ 2,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("select_expiration_time",
SELECT_IT_EXPIRATION_TIME,
- 2,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("select_migration_order",
+ 2,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("select_migration_order",
SELECT_IT_MIGRATION_ORDER,
- 3,
- __LINE__)) ||
- (GNUNET_OK !=
- pq_prepare("delrow",
- "DELETE FROM gn080 "
- "WHERE oid=$1",
- 1,
- __LINE__)) )
+ 3,
+ __LINE__)) ||
+ (GNUNET_OK !=
+ pq_prepare ("delrow",
+ "DELETE FROM gn080 " "WHERE oid=$1", 1, __LINE__)))
{
PQfinish (dbh);
dbh = NULL;
return GNUNET_SYSERR;
}
-
+
return GNUNET_OK;
}
@@ -351,7 +345,7 @@
GNUNET_mutex_lock (lock);
ret = payload;
if (stats)
- stats->set (stat_size, ret);
+ stats->set (stat_size, ret);
GNUNET_mutex_unlock (lock);
return (unsigned long long) (ret * 1.00);
/* benchmarking shows XX% overhead */
@@ -387,20 +381,18 @@
static int
delete_by_rowid (unsigned int rowid)
{
- const char * paramValues[] = { (const char* ) &rowid };
- int paramLengths[] = { sizeof(rowid) };
- const int paramFormats[] = {1};
- PGresult * ret;
+ const char *paramValues[] = { (const char *) &rowid };
+ int paramLengths[] = { sizeof (rowid) };
+ const int paramFormats[] = { 1 };
+ PGresult *ret;
ret = PQexecPrepared (dbh,
- "delrow",
- 1,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- if (GNUNET_OK != check_result (ret, PGRES_COMMAND_OK, "PQexecPrepared",
"delrow", __LINE__))
- {
+ "delrow",
+ 1, paramValues, paramLengths, paramFormats, 1);
+ if (GNUNET_OK !=
+ check_result (ret, PGRES_COMMAND_OK, "PQexecPrepared", "delrow",
+ __LINE__))
+ {
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -413,32 +405,30 @@
* assemble it into a GNUNET_DatastoreValue representation.
*/
static GNUNET_DatastoreValue *
-assembleDatum (PGresult * res,
- GNUNET_HashCode * key,
- unsigned int * rowid)
+assembleDatum (PGresult * res, GNUNET_HashCode * key, unsigned int *rowid)
{
GNUNET_DatastoreValue *value;
unsigned int size;
-
+
if (0 == PQntuples (res))
- return NULL; /* no result */
- if ( (1 != PQntuples (res)) ||
- (8 != PQnfields (res)) ||
- (sizeof(unsigned int) != PQfsize (res, 0)) ||
- (sizeof(unsigned int) != PQfsize (res, 7)) )
+ return NULL; /* no result */
+ if ((1 != PQntuples (res)) ||
+ (8 != PQnfields (res)) ||
+ (sizeof (unsigned int) != PQfsize (res, 0)) ||
+ (sizeof (unsigned int) != PQfsize (res, 7)))
{
GNUNET_GE_BREAK (NULL, 0);
return NULL;
}
- *rowid = * (unsigned int*) PQgetvalue (res, 0, 7);
- size = ntohl(* (unsigned int*) PQgetvalue (res, 0, 0));
- if ( (size < sizeof (GNUNET_DatastoreValue)) ||
- (sizeof(unsigned int) != PQfsize (res, 1)) ||
- (sizeof(unsigned int) != PQfsize (res, 2)) ||
- (sizeof(unsigned int) != PQfsize (res, 3)) ||
- (sizeof(unsigned long long) != PQfsize (res, 4)) ||
- (sizeof(GNUNET_HashCode) != PQgetlength (res, 0, 5)) ||
- (size - sizeof (GNUNET_DatastoreValue) != PQgetlength (res, 0, 6) ) )
+ *rowid = *(unsigned int *) PQgetvalue (res, 0, 7);
+ size = ntohl (*(unsigned int *) PQgetvalue (res, 0, 0));
+ if ((size < sizeof (GNUNET_DatastoreValue)) ||
+ (sizeof (unsigned int) != PQfsize (res, 1)) ||
+ (sizeof (unsigned int) != PQfsize (res, 2)) ||
+ (sizeof (unsigned int) != PQfsize (res, 3)) ||
+ (sizeof (unsigned long long) != PQfsize (res, 4)) ||
+ (sizeof (GNUNET_HashCode) != PQgetlength (res, 0, 5)) ||
+ (size - sizeof (GNUNET_DatastoreValue) != PQgetlength (res, 0, 6)))
{
GNUNET_GE_BREAK (NULL, 0);
delete_by_rowid (*rowid);
@@ -446,12 +436,13 @@
}
value = GNUNET_malloc (size);
value->size = htonl (size);
- value->type = * (unsigned int*) PQgetvalue (res, 0, 1);
- value->priority = * (unsigned int*) PQgetvalue (res, 0, 2);
- value->anonymity_level = * (unsigned int*) PQgetvalue (res, 0, 3);
- value->expiration_time = * (unsigned long long*) PQgetvalue (res, 0, 4);
- memcpy (key, PQgetvalue (res, 0, 5), sizeof (GNUNET_HashCode));
- memcpy (&value[1], PQgetvalue (res, 0, 6), size -
sizeof(GNUNET_DatastoreValue));
+ value->type = *(unsigned int *) PQgetvalue (res, 0, 1);
+ value->priority = *(unsigned int *) PQgetvalue (res, 0, 2);
+ value->anonymity_level = *(unsigned int *) PQgetvalue (res, 0, 3);
+ value->expiration_time = *(unsigned long long *) PQgetvalue (res, 0, 4);
+ memcpy (key, PQgetvalue (res, 0, 5), sizeof (GNUNET_HashCode));
+ memcpy (&value[1], PQgetvalue (res, 0, 6),
+ size - sizeof (GNUNET_DatastoreValue));
return value;
}
@@ -469,25 +460,24 @@
*/
static int
postgres_iterate (unsigned int type,
- int is_asc,
- unsigned int iter_select,
- GNUNET_DatastoreValueIterator dviter,
- void *closure)
+ int is_asc,
+ unsigned int iter_select,
+ GNUNET_DatastoreValueIterator dviter, void *closure)
{
GNUNET_DatastoreValue *datum;
int count;
- const char * pname;
+ const char *pname;
int pcount;
int iret;
- PGresult * ret;
+ PGresult *ret;
unsigned int last_prio;
unsigned long long last_expire;
unsigned int last_oid;
GNUNET_CronTime now;
GNUNET_HashCode key;
- const char * paramValues[3];
+ const char *paramValues[3];
int paramLengths[3];
- const int paramFormats[] = {1,1,1};
+ const int paramFormats[] = { 1, 1, 1 };
if (is_asc)
{
@@ -497,8 +487,8 @@
}
else
{
- last_prio = 0x7FFFFFFFL;
- last_oid = 0xFFFFFFFF;
+ last_prio = 0x7FFFFFFFL;
+ last_oid = 0xFFFFFFFF;
last_expire = 0x7FFFFFFFFFFFFFFFLL;
}
switch (iter_select)
@@ -506,86 +496,81 @@
case 0:
pname = "select_low_priority";
pcount = 2;
- paramValues[0] = (const char*) &last_prio;
- paramValues[1] = (const char*) &last_oid;
- paramLengths[0] = sizeof(last_prio);
- paramLengths[1] = sizeof(last_oid);
+ paramValues[0] = (const char *) &last_prio;
+ paramValues[1] = (const char *) &last_oid;
+ paramLengths[0] = sizeof (last_prio);
+ paramLengths[1] = sizeof (last_oid);
break;
case 1:
pname = "select_non_anonymous";
pcount = 2;
- paramValues[0] = (const char*) &last_prio;
- paramValues[1] = (const char*) &last_oid;
- paramLengths[0] = sizeof(last_prio);
- paramLengths[1] = sizeof(last_oid);
+ paramValues[0] = (const char *) &last_prio;
+ paramValues[1] = (const char *) &last_oid;
+ paramLengths[0] = sizeof (last_prio);
+ paramLengths[1] = sizeof (last_oid);
break;
case 2:
pname = "select_expiration_time";
pcount = 2;
- paramValues[0] = (const char*) &last_expire;
- paramValues[1] = (const char*) &last_oid;
- paramLengths[0] = sizeof(last_expire);
- paramLengths[1] = sizeof(last_oid);
+ paramValues[0] = (const char *) &last_expire;
+ paramValues[1] = (const char *) &last_oid;
+ paramLengths[0] = sizeof (last_expire);
+ paramLengths[1] = sizeof (last_oid);
break;
case 3:
pname = "select_migration_order";
pcount = 3;
- paramValues[0] = (const char*) &last_expire;
- paramValues[1] = (const char*) &last_oid;
- paramValues[2] = (const char*) &now;
- paramLengths[0] = sizeof(last_expire);
- paramLengths[1] = sizeof(last_oid);
- paramLengths[2] = sizeof(now);
+ paramValues[0] = (const char *) &last_expire;
+ paramValues[1] = (const char *) &last_oid;
+ paramValues[2] = (const char *) &now;
+ paramLengths[0] = sizeof (last_expire);
+ paramLengths[1] = sizeof (last_oid);
+ paramLengths[2] = sizeof (now);
break;
default:
GNUNET_GE_BREAK (NULL, 0);
return GNUNET_SYSERR;
- }
- now = GNUNET_htonll(GNUNET_get_time ());
+ }
+ now = GNUNET_htonll (GNUNET_get_time ());
count = 0;
GNUNET_mutex_lock (lock);
while (1)
{
- ret = PQexecPrepared(dbh,
- pname,
- pcount,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- if (GNUNET_OK != check_result (ret,
- PGRES_TUPLES_OK,
- "PQexecPrepared",
- pname,
- __LINE__))
- {
- GNUNET_mutex_unlock (lock);
- return GNUNET_SYSERR;
- }
- datum = assembleDatum (ret, &key, &last_oid);
+ ret = PQexecPrepared (dbh,
+ pname,
+ pcount,
+ paramValues, paramLengths, paramFormats, 1);
+ if (GNUNET_OK != check_result (ret,
+ PGRES_TUPLES_OK,
+ "PQexecPrepared", pname, __LINE__))
+ {
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_SYSERR;
+ }
+ datum = assembleDatum (ret, &key, &last_oid);
if (datum == NULL)
- break; /* iteration complete */
+ break; /* iteration complete */
last_prio = datum->priority;
last_expire = datum->expiration_time;
count++;
if (dviter != NULL)
{
- GNUNET_mutex_unlock (lock);
+ GNUNET_mutex_unlock (lock);
iret = dviter (&key, datum, closure, last_oid);
- GNUNET_mutex_lock (lock);
+ GNUNET_mutex_lock (lock);
if (iret == GNUNET_SYSERR)
{
GNUNET_free (datum);
break;
}
if (iret == GNUNET_NO)
- {
- payload -= getContentDatastoreSize (datum);
- lastSync++;
- delete_by_rowid(last_oid);
- }
- }
- GNUNET_free (datum);
+ {
+ payload -= getContentDatastoreSize (datum);
+ lastSync++;
+ delete_by_rowid (last_oid);
+ }
+ }
+ GNUNET_free (datum);
}
GNUNET_mutex_unlock (lock);
return count;
@@ -690,136 +675,121 @@
unsigned int type, GNUNET_DatastoreValueIterator iter, void *closure)
{
unsigned long long total;
- const char * paramValues[5];
+ const char *paramValues[5];
int paramLengths[5];
- const int paramFormats[] = {1,1,1,1,1};
+ const int paramFormats[] = { 1, 1, 1, 1, 1 };
unsigned int last_rowid;
unsigned int rowid;
int nparams;
int iret;
unsigned int n_type;
- const char * pname;
+ const char *pname;
long long count;
long long off;
long long limit_off;
- PGresult * ret;
+ PGresult *ret;
GNUNET_DatastoreValue *datum;
GNUNET_HashCode rkey;
if (key == NULL)
return iterateLowPriority (type, iter, closure);
GNUNET_mutex_lock (lock);
- paramValues[0] = (const char*) key;
- paramLengths[0] = sizeof(GNUNET_HashCode);
+ paramValues[0] = (const char *) key;
+ paramLengths[0] = sizeof (GNUNET_HashCode);
if (type != 0)
- {
- n_type = htonl(type);
+ {
+ n_type = htonl (type);
if (vhash != NULL)
- {
- paramValues[1] = (const char*) vhash;
- paramLengths[1] = sizeof(GNUNET_HashCode);
- paramValues[2] = (const char*) &n_type;
- paramLengths[2] = sizeof(unsigned int);
- paramValues[3] = (const char*) &last_rowid;
- paramLengths[3] = sizeof(last_rowid);
- paramValues[4] = (const char*) &limit_off;
- paramLengths[4] = sizeof(limit_off);
- nparams = 5;
- pname = "getvt";
- ret = PQexecParams(dbh,
- "SELECT count(*) FROM gn080 WHERE hash=$1 AND
vhash=$2 AND type=$3",
- 3,
- NULL,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- }
+ {
+ paramValues[1] = (const char *) vhash;
+ paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramValues[2] = (const char *) &n_type;
+ paramLengths[2] = sizeof (unsigned int);
+ paramValues[3] = (const char *) &last_rowid;
+ paramLengths[3] = sizeof (last_rowid);
+ paramValues[4] = (const char *) &limit_off;
+ paramLengths[4] = sizeof (limit_off);
+ nparams = 5;
+ pname = "getvt";
+ ret = PQexecParams (dbh,
+ "SELECT count(*) FROM gn080 WHERE hash=$1 AND
vhash=$2 AND type=$3",
+ 3,
+ NULL,
+ paramValues, paramLengths, paramFormats, 1);
+ }
else
- {
- paramValues[1] = (const char*) &n_type;
- paramLengths[1] = sizeof(unsigned int);
- paramValues[2] = (const char*) &last_rowid;
- paramLengths[2] = sizeof(last_rowid);
- paramValues[3] = (const char*) &limit_off;
- paramLengths[3] = sizeof(limit_off);
- nparams = 4;
- pname = "gett";
- ret = PQexecParams(dbh,
- "SELECT count(*) FROM gn080 WHERE hash=$1 AND
type=$2",
- 2,
- NULL,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- }
+ {
+ paramValues[1] = (const char *) &n_type;
+ paramLengths[1] = sizeof (unsigned int);
+ paramValues[2] = (const char *) &last_rowid;
+ paramLengths[2] = sizeof (last_rowid);
+ paramValues[3] = (const char *) &limit_off;
+ paramLengths[3] = sizeof (limit_off);
+ nparams = 4;
+ pname = "gett";
+ ret = PQexecParams (dbh,
+ "SELECT count(*) FROM gn080 WHERE hash=$1 AND
type=$2",
+ 2,
+ NULL,
+ paramValues, paramLengths, paramFormats, 1);
+ }
}
else
{
- if (vhash != NULL)
- {
- paramValues[1] = (const char*) vhash;
- paramLengths[1] = sizeof(GNUNET_HashCode);
- paramValues[2] = (const char*) &last_rowid;
- paramLengths[2] = sizeof(last_rowid);
- paramValues[3] = (const char*) &limit_off;
- paramLengths[3] = sizeof(limit_off);
- nparams = 4;
- pname = "getv";
- ret = PQexecParams(dbh,
- "SELECT count(*) FROM gn080 WHERE hash=$1 AND
vhash=$2",
- 2,
- NULL,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- }
+ if (vhash != NULL)
+ {
+ paramValues[1] = (const char *) vhash;
+ paramLengths[1] = sizeof (GNUNET_HashCode);
+ paramValues[2] = (const char *) &last_rowid;
+ paramLengths[2] = sizeof (last_rowid);
+ paramValues[3] = (const char *) &limit_off;
+ paramLengths[3] = sizeof (limit_off);
+ nparams = 4;
+ pname = "getv";
+ ret = PQexecParams (dbh,
+ "SELECT count(*) FROM gn080 WHERE hash=$1 AND
vhash=$2",
+ 2,
+ NULL,
+ paramValues, paramLengths, paramFormats, 1);
+ }
else
- {
- paramValues[1] = (const char*) &last_rowid;
- paramLengths[1] = sizeof(last_rowid);
- paramValues[2] = (const char*) &limit_off;
- paramLengths[2] = sizeof(limit_off);
- nparams = 3;
- pname = "get";
- ret = PQexecParams(dbh,
- "SELECT count(*) FROM gn080 WHERE hash=$1",
- 1,
- NULL,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- }
+ {
+ paramValues[1] = (const char *) &last_rowid;
+ paramLengths[1] = sizeof (last_rowid);
+ paramValues[2] = (const char *) &limit_off;
+ paramLengths[2] = sizeof (limit_off);
+ nparams = 3;
+ pname = "get";
+ ret = PQexecParams (dbh,
+ "SELECT count(*) FROM gn080 WHERE hash=$1",
+ 1,
+ NULL,
+ paramValues, paramLengths, paramFormats, 1);
+ }
}
- if (GNUNET_OK != check_result (ret,
- PGRES_TUPLES_OK,
- "PQexecParams",
- pname,
- __LINE__))
- {
+ if (GNUNET_OK != check_result (ret,
+ PGRES_TUPLES_OK,
+ "PQexecParams", pname, __LINE__))
+ {
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- if ( (PQntuples (ret) != 1) ||
- (PQnfields (ret) != 1) ||
- (PQgetlength (ret, 0, 0) != sizeof(unsigned long long) ) )
+ if ((PQntuples (ret) != 1) ||
+ (PQnfields (ret) != 1) ||
+ (PQgetlength (ret, 0, 0) != sizeof (unsigned long long)))
{
GNUNET_GE_BREAK (NULL, 0);
- PQclear(ret);
+ PQclear (ret);
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
- total = GNUNET_ntohll(*(const unsigned long long*) PQgetvalue(ret, 0, 0));
- PQclear(ret);
- if ( (iter == NULL) || (total == 0) )
+ total =
+ GNUNET_ntohll (*(const unsigned long long *) PQgetvalue (ret, 0, 0));
+ PQclear (ret);
+ if ((iter == NULL) || (total == 0))
{
GNUNET_mutex_unlock (lock);
- fprintf(stderr,
- "Total is %llu\n",
- total);
+ fprintf (stderr, "Total is %llu\n", total);
return total;
}
@@ -834,54 +804,49 @@
limit_off = 0;
ret = PQexecPrepared (dbh,
- pname,
- nparams,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
+ pname,
+ nparams,
+ paramValues, paramLengths, paramFormats, 1);
if (GNUNET_OK != check_result (ret,
- PGRES_TUPLES_OK,
- "PQexecPrepared",
- pname,
- __LINE__))
- {
- GNUNET_mutex_unlock (lock);
- return GNUNET_SYSERR;
- }
+ PGRES_TUPLES_OK,
+ "PQexecPrepared", pname, __LINE__))
+ {
+ GNUNET_mutex_unlock (lock);
+ return GNUNET_SYSERR;
+ }
datum = assembleDatum (ret, &rkey, &rowid);
last_rowid = rowid + 1;
PQclear (ret);
if (datum == NULL)
- {
- total--;
- if (count == total)
- break;
- continue;
- }
- if ( (key != NULL) &&
- (0 != memcmp (&rkey, key, sizeof (GNUNET_HashCode))))
- {
- GNUNET_GE_BREAK (NULL, 0);
- GNUNET_free (datum);
- continue;
- }
+ {
+ total--;
+ if (count == total)
+ break;
+ continue;
+ }
+ if ((key != NULL) &&
+ (0 != memcmp (&rkey, key, sizeof (GNUNET_HashCode))))
+ {
+ GNUNET_GE_BREAK (NULL, 0);
+ GNUNET_free (datum);
+ continue;
+ }
GNUNET_mutex_unlock (lock);
count++;
iret = iter (&rkey, datum, closure, rowid);
GNUNET_mutex_lock (lock);
if (iret == GNUNET_SYSERR)
- {
- GNUNET_free (datum);
- break;
- }
+ {
+ GNUNET_free (datum);
+ break;
+ }
if (iret == GNUNET_NO)
- {
- payload -= getContentDatastoreSize (datum);
- lastSync++;
- delete_by_rowid (rowid);
- }
- GNUNET_free (datum);
+ {
+ payload -= getContentDatastoreSize (datum);
+ lastSync++;
+ delete_by_rowid (rowid);
+ }
+ GNUNET_free (datum);
if (count + off == total)
last_rowid = 0; /* back to start */
if (count == total)
@@ -900,31 +865,30 @@
static int
put (const GNUNET_HashCode * key, const GNUNET_DatastoreValue * value)
{
- unsigned int size = ntohl(value->size);
+ unsigned int size = ntohl (value->size);
GNUNET_HashCode vhash;
- PGresult * ret;
- const char * paramValues[] = {
- (const char*) &value->size,
- (const char*) &value->type,
- (const char*) &value->priority,
- (const char*) &value->anonymity_level,
- (const char*) &value->expiration_time,
- (const char*) key,
- (const char*) &vhash,
- (const char*) &value[1]
- };
- int paramLengths[] =
- {
- sizeof(value->size),
- sizeof(value->type),
- sizeof(value->priority),
- sizeof(value->anonymity_level),
- sizeof(value->expiration_time),
- sizeof(GNUNET_HashCode),
- sizeof(GNUNET_HashCode),
- size - sizeof (GNUNET_DatastoreValue)
- };
- const int paramFormats[] = {1,1,1,1,1,1,1,1};
+ PGresult *ret;
+ const char *paramValues[] = {
+ (const char *) &value->size,
+ (const char *) &value->type,
+ (const char *) &value->priority,
+ (const char *) &value->anonymity_level,
+ (const char *) &value->expiration_time,
+ (const char *) key,
+ (const char *) &vhash,
+ (const char *) &value[1]
+ };
+ int paramLengths[] = {
+ sizeof (value->size),
+ sizeof (value->type),
+ sizeof (value->priority),
+ sizeof (value->anonymity_level),
+ sizeof (value->expiration_time),
+ sizeof (GNUNET_HashCode),
+ sizeof (GNUNET_HashCode),
+ size - sizeof (GNUNET_DatastoreValue)
+ };
+ const int paramFormats[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
if (size < sizeof (GNUNET_DatastoreValue))
{
@@ -936,18 +900,11 @@
if (lastSync > 1000)
syncStats ();
ret = PQexecPrepared (dbh,
- "put",
- 8,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
- if (GNUNET_OK != check_result (ret,
- PGRES_COMMAND_OK,
- "PQexecPrepared",
- "put",
- __LINE__))
- {
+ "put", 8, paramValues, paramLengths, paramFormats, 1);
+ if (GNUNET_OK != check_result (ret,
+ PGRES_COMMAND_OK,
+ "PQexecPrepared", "put", __LINE__))
+ {
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -965,37 +922,30 @@
static int
update (unsigned long long uid, int delta, GNUNET_CronTime expire)
{
- unsigned int oid = (unsigned int) uid; /* only 32 bit for postgres */
- int n_delta = htonl(delta);
- GNUNET_CronTime n_expire = GNUNET_htonll(expire);
- PGresult * ret;
- const char * paramValues[] = {
- (const char*) &n_delta,
- (const char*) &n_expire,
- (const char*) &oid,
- };
- int paramLengths[] =
- {
- sizeof(n_delta),
- sizeof(n_expire),
- sizeof(oid),
- };
- const int paramFormats[] = {1,1,1};
+ unsigned int oid = (unsigned int) uid; /* only 32 bit for postgres */
+ int n_delta = htonl (delta);
+ GNUNET_CronTime n_expire = GNUNET_htonll (expire);
+ PGresult *ret;
+ const char *paramValues[] = {
+ (const char *) &n_delta,
+ (const char *) &n_expire,
+ (const char *) &oid,
+ };
+ int paramLengths[] = {
+ sizeof (n_delta),
+ sizeof (n_expire),
+ sizeof (oid),
+ };
+ const int paramFormats[] = { 1, 1, 1 };
GNUNET_mutex_lock (lock);
ret = PQexecPrepared (dbh,
- "update",
- 3,
- paramValues,
- paramLengths,
- paramFormats,
- 1);
+ "update",
+ 3, paramValues, paramLengths, paramFormats, 1);
if (GNUNET_OK != check_result (ret,
- PGRES_COMMAND_OK,
- "PQexecPrepared",
- "update",
- __LINE__))
- {
+ PGRES_COMMAND_OK,
+ "PQexecPrepared", "update", __LINE__))
+ {
GNUNET_mutex_unlock (lock);
return GNUNET_SYSERR;
}
@@ -1010,7 +960,7 @@
postgres_shutdown ()
{
if (dbh == NULL)
- return; /* already down */
+ return; /* already down */
#if DEBUG_POSTGRES
GNUNET_GE_LOG (coreAPI->ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST | GNUNET_GE_USER,
@@ -1067,7 +1017,8 @@
{
stat_size = stats->create (gettext_noop ("# bytes in datastore"));
#if DEBUG_POSTGRES
- stat_mem = stats->create (gettext_noop ("# bytes allocated by
Postgres"));
+ stat_mem =
+ stats->create (gettext_noop ("# bytes allocated by Postgres"));
#endif
}
@@ -1112,7 +1063,7 @@
update_module_sqstore_postgres (GNUNET_UpdateAPI * uapi)
{
lock = GNUNET_mutex_create (GNUNET_NO);
- if (GNUNET_OK != init_connection ())
+ if (GNUNET_OK != init_connection ())
{
GNUNET_mutex_destroy (lock);
return;
Modified: GNUnet/src/applications/sqstore_postgres/postgres_test2.c
===================================================================
--- GNUnet/src/applications/sqstore_postgres/postgres_test2.c 2009-01-03
10:02:44 UTC (rev 8087)
+++ GNUnet/src/applications/sqstore_postgres/postgres_test2.c 2009-01-03
10:10:25 UTC (rev 8088)
@@ -150,7 +150,7 @@
GNUNET_random_u32 (GNUNET_RANDOM_QUALITY_WEAK, 1000));
#if RANDOMIZE
gcry_randomize (&value[1], size - sizeof (GNUNET_DatastoreValue),
- GCRY_WEAK_RANDOM);
+ GCRY_WEAK_RANDOM);
#else
memset (&value[1], i, size - sizeof (GNUNET_DatastoreValue));
if (i > 255)
@@ -206,9 +206,9 @@
int i;
int j;
unsigned long long size;
- PGresult * res;
- PGconn * dbh = PQconnectdb("dbname=gnunetcheck");
-
+ PGresult *res;
+ PGconn *dbh = PQconnectdb ("dbname=gnunetcheck");
+
for (i = 0; i < ITERATIONS; i++)
{
#if REPORT_ID
@@ -228,26 +228,20 @@
else
api->iterateExpirationTime (0, &iterateDelete, api);
size = 0;
- res = PQexec (dbh, "SELECT pg_database_size('gnunetcheck')");
- if (PQresultStatus (res) != PGRES_TUPLES_OK)
- {
- fprintf(stderr,
- "Failed with error: %s",
- PQerrorMessage(dbh));
- PQclear(res);
- abort();
- }
- ASSERT (1 ==
- sscanf(PQgetvalue(res, 0, 0),
- "%llu",
- &size));
+ res = PQexec (dbh, "SELECT pg_database_size('gnunetcheck')");
+ if (PQresultStatus (res) != PGRES_TUPLES_OK)
+ {
+ fprintf (stderr, "Failed with error: %s", PQerrorMessage (dbh));
+ PQclear (res);
+ abort ();
+ }
+ ASSERT (1 == sscanf (PQgetvalue (res, 0, 0), "%llu", &size));
PQclear (res);
printf (
#if REPORT_ID
"\n"
#endif
- "Useful %lluk, API %lluk, disk %lluk (%.2f%%) / %lluk ops /
%llu ops/s\n",
- stored_bytes / 1024, /* used size in k */
+ "Useful %lluk, API %lluk, disk %lluk (%.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/testing/remote.c
===================================================================
--- GNUnet/src/applications/testing/remote.c 2009-01-03 10:02:44 UTC (rev
8087)
+++ GNUnet/src/applications/testing/remote.c 2009-01-03 10:10:25 UTC (rev
8088)
@@ -408,8 +408,7 @@
GNUNET_REMOTE_start_daemon (remote_gnunetd_path, "/tmp/",
temp, remote_config_path,
curr_host, ssh_username,
- temp_pos->
- remote_friend_file_path);
+
temp_pos->remote_friend_file_path);
GNUNET_GC_get_configuration_value_number (basecfg,
"NETWORK",
Modified: GNUnet/src/applications/testing/remotetopologies.c
===================================================================
--- GNUnet/src/applications/testing/remotetopologies.c 2009-01-03 10:02:44 UTC
(rev 8087)
+++ GNUnet/src/applications/testing/remotetopologies.c 2009-01-03 10:10:25 UTC
(rev 8088)
@@ -380,15 +380,13 @@
{
fprintf (stderr, ".");
if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock1,
- &h2->
-
senderIdentity))
+
&h2->senderIdentity))
{
ret = GNUNET_OK;
break;
}
if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock2,
- &h1->
-
senderIdentity))
+
&h1->senderIdentity))
{
ret = GNUNET_OK;
break;
Modified: GNUnet/src/applications/testing/testing.c
===================================================================
--- GNUnet/src/applications/testing/testing.c 2009-01-03 10:02:44 UTC (rev
8087)
+++ GNUnet/src/applications/testing/testing.c 2009-01-03 10:10:25 UTC (rev
8088)
@@ -283,8 +283,7 @@
fprintf (stderr, ".");
#endif
if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock1,
- &h2->
-
senderIdentity))
+
&h2->senderIdentity))
{
ret = GNUNET_OK;
GNUNET_free_non_null (h1);
@@ -292,8 +291,7 @@
break;
}
if (GNUNET_YES == GNUNET_IDENTITY_request_connect (sock2,
- &h1->
-
senderIdentity))
+
&h1->senderIdentity))
{
ret = GNUNET_OK;
GNUNET_free_non_null (h1);
Modified: GNUnet/src/intlemu/intlemu.c
===================================================================
--- GNUnet/src/intlemu/intlemu.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/intlemu/intlemu.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -15,132 +15,121 @@
static pthread_mutex_t intlemu_lock;
static CFMutableDictionaryRef intlemu_dict;
-static void intlemu_cstring_release(CFAllocatorRef allocator, const void
*value)
+static void
+intlemu_cstring_release (CFAllocatorRef allocator, const void *value)
{
- free((void *)value);
+ free ((void *) value);
}
-void __attribute__ ((constructor)) intlemu_init_() {
- CFDictionaryValueCallBacks cstring_value_callbacks =
- {
- 0, /* version */
- NULL, /* retain callback */
- &intlemu_cstring_release, /* release callback */
- NULL, /* copy description */
- NULL /* equal */
- };
- if (pthread_mutex_init(&intlemu_lock, NULL) != 0)
- abort();
-
- intlemu_dict = CFDictionaryCreateMutable(
- kCFAllocatorDefault,
- 0,
- &kCFCopyStringDictionaryKeyCallBacks,
- &cstring_value_callbacks);
- if (intlemu_dict == NULL)
- abort();
+void __attribute__ ((constructor)) intlemu_init_ ()
+{
+ CFDictionaryValueCallBacks cstring_value_callbacks = {
+ 0, /* version */
+ NULL, /* retain callback */
+ &intlemu_cstring_release, /* release callback */
+ NULL, /* copy description */
+ NULL /* equal */
+ };
+ if (pthread_mutex_init (&intlemu_lock, NULL) != 0)
+ abort ();
+
+ intlemu_dict = CFDictionaryCreateMutable (kCFAllocatorDefault,
+ 0,
+
&kCFCopyStringDictionaryKeyCallBacks,
+ &cstring_value_callbacks);
+ if (intlemu_dict == NULL)
+ abort ();
}
-void __attribute__ ((destructor)) intlemu_fini_() {
- if (intlemu_dict)
- CFRelease(intlemu_dict);
+void __attribute__ ((destructor)) intlemu_fini_ ()
+{
+ if (intlemu_dict)
+ CFRelease (intlemu_dict);
- pthread_mutex_destroy(&intlemu_lock);
+ pthread_mutex_destroy (&intlemu_lock);
}
-char * intlemu_bgettext (CFBundleRef bundle, const char *msgid)
+char *
+intlemu_bgettext (CFBundleRef bundle, const char *msgid)
{
- CFStringRef key;
- const char *value;
- CFStringRef s;
- CFRange r;
- CFIndex len;
- CFIndex clen;
- char *buf;
+ CFStringRef key;
+ const char *value;
+ CFStringRef s;
+ CFRange r;
+ CFIndex len;
+ CFIndex clen;
+ char *buf;
- if (msgid == NULL)
- return NULL;
- if (bundle == NULL)
- return msgid;
+ if (msgid == NULL)
+ return NULL;
+ if (bundle == NULL)
+ return msgid;
- key = CFStringCreateWithBytes(
- kCFAllocatorDefault,
- (const UInt8 *)msgid,
- (CFIndex)strlen(msgid),
- kCFStringEncodingUTF8,
- false);
-
- if (pthread_mutex_lock(&intlemu_lock) != 0)
- abort();
- value = (char *)CFDictionaryGetValue(intlemu_dict, key);
- if (pthread_mutex_unlock(&intlemu_lock) != 0)
- abort();
- if (value != NULL) {
- CFRelease(key);
- return (char *)value;
- }
+ key = CFStringCreateWithBytes (kCFAllocatorDefault,
+ (const UInt8 *) msgid,
+ (CFIndex) strlen (msgid),
+ kCFStringEncodingUTF8, false);
- /* no cached translaation, so, find one from the bundle */
- s = CFBundleCopyLocalizedString(
- bundle,
- key,
- NULL,
- NULL);
- if (s == key) {
- CFRelease(key);
- return (char *)msgid;
- }
- /* get the length in bytes */
- r.location = 0;
- r.length = CFStringGetLength(s);
- len = 0;
- clen = CFStringGetBytes(
- s,
- r,
- kCFStringEncodingUTF8,
- 0,
- false,
- NULL,
- 0,
- &len);
- buf = NULL;
- if (clen == r.length) {
- buf = malloc(len + 1);
- }
-
- if (buf == NULL) {
- CFRelease(s);
- CFRelease(key);
- return (char *)msgid;
- }
+ if (pthread_mutex_lock (&intlemu_lock) != 0)
+ abort ();
+ value = (char *) CFDictionaryGetValue (intlemu_dict, key);
+ if (pthread_mutex_unlock (&intlemu_lock) != 0)
+ abort ();
+ if (value != NULL)
+ {
+ CFRelease (key);
+ return (char *) value;
+ }
- clen = CFStringGetBytes(
- s,
- r,
- kCFStringEncodingUTF8,
- 0,
- false,
- (UInt8 *)buf,
- len,
- &len);
- buf[len] = '\0';
- if (clen == r.length) {
- if (pthread_mutex_lock(&intlemu_lock) != 0)
- abort();
- CFDictionaryAddValue(intlemu_dict, key, buf);
- if (pthread_mutex_unlock(&intlemu_lock) != 0)
- abort();
- value = buf;
- }
- else {
- free(buf);
- value = msgid;
- }
+ /* no cached translaation, so, find one from the bundle */
+ s = CFBundleCopyLocalizedString (bundle, key, NULL, NULL);
+ if (s == key)
+ {
+ CFRelease (key);
+ return (char *) msgid;
+ }
+ /* get the length in bytes */
+ r.location = 0;
+ r.length = CFStringGetLength (s);
+ len = 0;
+ clen = CFStringGetBytes (s,
+ r, kCFStringEncodingUTF8, 0, false, NULL, 0, &len);
+ buf = NULL;
+ if (clen == r.length)
+ {
+ buf = malloc (len + 1);
+ }
- CFRelease(s);
+ if (buf == NULL)
+ {
+ CFRelease (s);
+ CFRelease (key);
+ return (char *) msgid;
+ }
- CFRelease(key);
+ clen = CFStringGetBytes (s,
+ r,
+ kCFStringEncodingUTF8,
+ 0, false, (UInt8 *) buf, len, &len);
+ buf[len] = '\0';
+ if (clen == r.length)
+ {
+ if (pthread_mutex_lock (&intlemu_lock) != 0)
+ abort ();
+ CFDictionaryAddValue (intlemu_dict, key, buf);
+ if (pthread_mutex_unlock (&intlemu_lock) != 0)
+ abort ();
+ value = buf;
+ }
+ else
+ {
+ free (buf);
+ value = msgid;
+ }
- return (char *)value;
-}
+ CFRelease (s);
+ CFRelease (key);
+
+ return (char *) value;
+}
Modified: GNUnet/src/intlemu/libintlemu.h
===================================================================
--- GNUnet/src/intlemu/libintlemu.h 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/intlemu/libintlemu.h 2009-01-03 10:10:25 UTC (rev 8088)
@@ -21,6 +21,6 @@
#define gettext_noop(s) s
-extern char * intlemu_bgettext (CFBundleRef bundle, const char *msgid);
+extern char *intlemu_bgettext (CFBundleRef bundle, const char *msgid);
#endif
Modified: GNUnet/src/server/connection.c
===================================================================
--- GNUnet/src/server/connection.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/server/connection.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -741,8 +741,8 @@
if (root->session.tsession != NULL)
GNUNET_GE_ASSERT (NULL,
GNUNET_OK ==
- transport->assert_associated (root->session.
- tsession,
+ transport->assert_associated (root->
+ session.tsession,
__FILE__));
root = root->overflowChain;
}
@@ -1939,8 +1939,8 @@
stats->change (stat_transmitted, p);
be->available_send_window -= p;
be->lastSequenceNumberSend++;
- GNUNET_CORE_connection_reserve_downstream_bandwidth (&be->session.
- sender, 0);
+ GNUNET_CORE_connection_reserve_downstream_bandwidth (&be->
+ session.sender, 0);
if (be->idealized_limit > be->max_transmitted_limit)
be->max_transmitted_limit = be->idealized_limit;
else /* age */
@@ -2520,8 +2520,8 @@
{
IF_GELOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
- GNUNET_hash_to_enc (&entries[u]->session.sender.
- hashPubKey, &enc));
+ GNUNET_hash_to_enc (&entries[u]->session.
+ sender.hashPubKey, &enc));
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_USER,
"peer `%s' transmitted above limit: %llu bpm > %u
bpm\n",
@@ -2544,8 +2544,8 @@
#if DEBUG_CONNECTION
IF_GELOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_BULK | GNUNET_GE_DEVELOPER,
- GNUNET_hash_to_enc (&entries[u]->session.sender.
- hashPubKey, &enc));
+ GNUNET_hash_to_enc (&entries[u]->session.
+ sender.hashPubKey, &enc));
GNUNET_GE_LOG (ectx,
GNUNET_GE_INFO | GNUNET_GE_BULK |
GNUNET_GE_DEVELOPER,
@@ -2606,8 +2606,8 @@
for (u = 0; u < activePeerCount; u++)
{
GNUNET_CORE_connection_reserve_downstream_bandwidth (&entries
- [u]->
- session.sender, 0);
+ [u]->session.
+ sender, 0);
entries[u]->idealized_limit = 0;
}
while ((schedulableBandwidth > activePeerCount * 100) &&
@@ -2941,8 +2941,8 @@
IF_GELOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
- GNUNET_hash_to_enc (&root->session.sender.
- hashPubKey, &enc));
+ GNUNET_hash_to_enc (&root->session.
+ sender.hashPubKey, &enc));
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
@@ -3045,8 +3045,8 @@
IF_GELOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
- GNUNET_hash_to_enc (&root->session.sender.
- hashPubKey, &enc));
+ GNUNET_hash_to_enc (&root->session.
+ sender.hashPubKey, &enc));
GNUNET_GE_LOG (ectx,
GNUNET_GE_DEBUG | GNUNET_GE_REQUEST |
GNUNET_GE_DEVELOPER,
Modified: GNUnet/src/setup/cocoa/GNUNETSetupView.h
===================================================================
--- GNUnet/src/setup/cocoa/GNUNETSetupView.h 2009-01-03 10:02:44 UTC (rev
8087)
+++ GNUnet/src/setup/cocoa/GNUNETSetupView.h 2009-01-03 10:10:25 UTC (rev
8088)
@@ -46,30 +46,36 @@
}
-(id) init;
--(id) initWithConfig: (struct GNUNET_GC_Configuration *) config setupContext:
(struct GNUNET_GNS_Context *) gns errorContext: (struct GNUNET_GE_Context *)
ectx maxWidth:(float)
- maxWidth;
+-(id) initWithConfig:(struct GNUNET_GC_Configuration *)
+ config setupContext:(struct GNUNET_GNS_Context *)
+ gns errorContext:(struct GNUNET_GE_Context *)
+ ectx maxWidth:(float) maxWidth;
-(void) dealloc;
-(struct GNUNET_GC_Configuration *) gnunetGCConfiguration;
-(struct GNUNET_GE_Context *) gnunetGEContext;
-(void) updateVisibility;
-(void) linkVisibilityNode:(struct GNUNET_GNS_TreeNode *)
pos view:(NSView *) w;
--(int) addNodeToTreeWithTabView: (NSTabView *) tabView parent:
(GNUNETSetupTreeNode *) parent pos:(struct GNUNET_GNS_TreeNode *)
- pos;
--(int) addLeafToTreeWithContainer: (PackingBoxContainer *) parent pos:(struct
GNUNET_GNS_TreeNode *)
- pos;
+-(int) addNodeToTreeWithTabView:(NSTabView *)
+ tabView parent:(GNUNETSetupTreeNode *)
+ parent pos:(struct GNUNET_GNS_TreeNode *) pos;
+-(int) addLeafToTreeWithContainer:(PackingBoxContainer *)
+ parent pos:(struct GNUNET_GNS_TreeNode *) pos;
-(void) repackViewTreeFrom:(NSView *) v;
--(void) alertDidEnd: (NSAlert *) alert returnCode: (int) returnCode
contextInfo:(void *)
- contextInfo;
--(void) tabView: (NSTabView *) tabView didSelectTabViewItem:(NSTabViewItem *)
- tabViewItem;
+-(void) alertDidEnd:(NSAlert *)
+ alert returnCode:(int)
+ returnCode contextInfo:(void *) contextInfo;
+-(void) tabView:(NSTabView *)
+ tabView didSelectTabViewItem:(NSTabViewItem *) tabViewItem;
// NSOutlineView data source
-(int) outlineView:(NSOutlineView *)
outlineView numberOfChildrenOfItem:(id) item;
-(BOOL) outlineView:(NSOutlineView *)
outlineView isItemExpandable:(id) item;
--(id) outlineView: (NSOutlineView *) outlineView child: (int) index ofItem:(id)
- item;
--(id) outlineView: (NSOutlineView *) outlineView objectValueForTableColumn:
(NSTableColumn *) tableColumn byItem:(id)
- item;
+-(id) outlineView:(NSOutlineView *)
+ outlineView child:(int)
+ index ofItem:(id) item;
+-(id) outlineView:(NSOutlineView *)
+ outlineView objectValueForTableColumn:(NSTableColumn *)
+ tableColumn byItem:(id) item;
@end
Modified: GNUnet/src/setup/gtk/wizard_gtk.c
===================================================================
--- GNUnet/src/setup/gtk/wizard_gtk.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/setup/gtk/wizard_gtk.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -396,7 +396,8 @@
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s %s",
prefix, error);
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s %s",
+ prefix, error);
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
}
Modified: GNUnet/src/setup/lib/gns.c
===================================================================
--- GNUnet/src/setup/lib/gns.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/setup/lib/gns.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -122,8 +122,8 @@
val = GNUNET_GC_get_configuration_value_yesno (cfg,
section,
option,
- pos->value.Boolean.
- def);
+ pos->value.
+ Boolean.def);
if (val == GNUNET_SYSERR)
{
return GNUNET_SYSERR;
@@ -138,18 +138,9 @@
if (GNUNET_SYSERR == GNUNET_GC_get_configuration_value_number (cfg,
section,
option,
- pos->
- value.
- UInt64.
- min,
- pos->
- value.
- UInt64.
- max,
- pos->
- value.
- UInt64.
- def,
+
pos->value.UInt64.min,
+
pos->value.UInt64.max,
+
pos->value.UInt64.def,
&val))
{
return GNUNET_SYSERR;
@@ -194,10 +185,7 @@
if (GNUNET_SYSERR == GNUNET_GC_get_configuration_value_string (cfg,
section,
option,
- pos->
- value.
- String.
- def,
+
pos->value.String.def,
&val))
return GNUNET_SYSERR;
GNUNET_free (pos->value.String.val);
@@ -214,14 +202,8 @@
(const
char
**)
- pos->
- value.
- String.
-
legalRange,
- pos->
- value.
- String.
- def,
+
pos->value.String.legalRange,
+
pos->value.String.def,
&ival))
return GNUNET_SYSERR;
GNUNET_free (pos->value.String.val);
Modified: GNUnet/src/setup/ncurses/mconf.c
===================================================================
--- GNUnet/src/setup/ncurses/mconf.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/setup/ncurses/mconf.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -178,10 +178,8 @@
case DLG_EXIT_CANCEL:
if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
- pos->
- section,
- pos->
- option,
+
pos->section,
+
pos->option,
st ==
DLG_EXIT_OK
? "YES" :
@@ -215,12 +213,9 @@
case DLG_EXIT_OK:
if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
- pos->
- section,
- pos->
- option,
- fitem.
- text))
+
pos->section,
+
pos->option,
+
fitem.text))
{
show_help (pos->option,
_("Internal error! (Value invalid?)"));
@@ -281,13 +276,9 @@
case DLG_EXIT_OK:
if (0 != GNUNET_GC_set_configuration_value_choice (cfg,
ectx,
- pos->
- section,
- pos->
- option,
- val->
- String.
- legalRange
+
pos->section,
+
pos->option,
+
val->String.legalRange
[msel]))
{
show_help (pos->option,
@@ -365,10 +356,8 @@
tmp[strlen (tmp) - 1] = '\0';
if (0 != GNUNET_GC_set_configuration_value_choice (cfg,
ectx,
- pos->
- section,
- pos->
- option,
+
pos->section,
+
pos->option,
tmp))
{
GNUNET_free (tmp);
@@ -411,12 +400,9 @@
}
if (0 != GNUNET_GC_set_configuration_value_string (cfg,
ectx,
- pos->
- section,
- pos->
- option,
- fitem.
- text))
+
pos->section,
+
pos->option,
+
fitem.text))
{
show_help (pos->option,
_("Internal error! (Value invalid?)"));
@@ -462,10 +448,8 @@
}
if (0 != GNUNET_GC_set_configuration_value_number (cfg,
ectx,
- pos->
-
section,
- pos->
-
option,
+
pos->section,
+
pos->option,
lval))
{
show_help (pos->option,
Modified: GNUnet/src/transports/http.c
===================================================================
--- GNUnet/src/transports/http.c 2009-01-03 10:02:44 UTC (rev 8087)
+++ GNUnet/src/transports/http.c 2009-01-03 10:10:25 UTC (rev 8088)
@@ -1006,8 +1006,9 @@
cpy = sizeof (GNUNET_MessageHeader) - httpSession->cs.client.rpos1;
if (cpy > have)
cpy = have;
- memcpy (&httpSession->cs.client.
- rbuff1[httpSession->cs.client.rpos1], &inbuf[poff], cpy);
+ memcpy (&httpSession->cs.
+ client.rbuff1[httpSession->cs.client.rpos1], &inbuf[poff],
+ cpy);
httpSession->cs.client.rpos1 += cpy;
have -= cpy;
poff += cpy;
@@ -1027,8 +1028,9 @@
httpSession->cs.client.rpos2;
if (cpy > have)
cpy = have;
- memcpy (&httpSession->cs.client.
- rbuff2[httpSession->cs.client.rpos2], &inbuf[poff], cpy);
+ memcpy (&httpSession->cs.
+ client.rbuff2[httpSession->cs.client.rpos2], &inbuf[poff],
+ cpy);
have -= cpy;
poff += cpy;
httpSession->cs.client.rpos2 += cpy;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8088 - in GNUnet/src: applications/datastore applications/fs/collection applications/fs/ecrs applications/fs/fsui applications/fs/tools applications/sqstore_mysql applications/sqstore_postgres applications/testing intlemu server setup/cocoa setup/gtk setup/lib setup/ncurses transports,
gnunet <=