From 3a3219bcc1d219bf012d20bcc87c03041f59044d Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sun, 1 Apr 2012 18:20:44 +0000 Subject: -removing legacy #ifdefs --- src/datastore/plugin_datastore_mysql.c | 12 ------------ src/datastore/plugin_datastore_postgres.c | 15 --------------- src/datastore/plugin_datastore_sqlite.c | 27 --------------------------- 3 files changed, 54 deletions(-) (limited to 'src/datastore') diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c index e2c77edd8..ed7741cfc 100644 --- a/src/datastore/plugin_datastore_mysql.c +++ b/src/datastore/plugin_datastore_mysql.c @@ -121,7 +121,6 @@ #include "gnunet_util_lib.h" #include "gnunet_mysql_lib.h" -#define DEBUG_MYSQL GNUNET_EXTRA_LOGGING #define MAX_DATUM_SIZE 65536 @@ -227,10 +226,8 @@ do_delete_entry (struct Plugin *plugin, unsigned long long uid) { int ret; -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting value %llu from gn090 table\n", uid); -#endif ret = GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->delete_entry_by_uid, NULL, MYSQL_TYPE_LONGLONG, &uid, GNUNET_YES, -1); @@ -323,11 +320,9 @@ mysql_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, MYSQL_TYPE_BLOB, &vhash, hashSize2, &hashSize2, MYSQL_TYPE_BLOB, data, lsize, &lsize, -1)) return GNUNET_SYSERR; -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Inserted value `%s' with size %u into gn090 table\n", GNUNET_h2s (key), (unsigned int) size); -#endif if (size > 0) plugin->env->duc (plugin->env->cls, size); return GNUNET_OK; @@ -366,11 +361,9 @@ mysql_plugin_update (void *cls, uint64_t uid, int delta, unsigned long long lexpire = expire.abs_value; int ret; -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Updating value %llu adding %d to priority and maxing exp at %llu\n", vkey, delta, lexpire); -#endif ret = GNUNET_MYSQL_statement_run_prepared (plugin->mc, plugin->update_entry, NULL, MYSQL_TYPE_LONG, &delta, GNUNET_NO, @@ -456,11 +449,9 @@ execute_select (struct Plugin *plugin, struct GNUNET_MYSQL_StatementHandle *stmt proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u-byte value under key `%s' with prio %u, anon %u, expire %llu selecting from gn090 table\n", (unsigned int) size, GNUNET_h2s (&key), priority, anonymity, exp); -#endif GNUNET_assert (size < MAX_DATUM_SIZE); expiration.abs_value = exp; ret = @@ -567,12 +558,9 @@ mysql_plugin_get_key (void *cls, uint64_t offset, const GNUNET_HashCode * key, } offset = offset % total; off = (unsigned long long) offset; -#if DEBUG_MYSQL GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Obtaining %llu/%lld result for GET `%s'\n", off, total, GNUNET_h2s (key)); -#endif - if (type != GNUNET_BLOCK_TYPE_ANY) { if (NULL != vhash) diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c index 5c7f75d5e..bbbbf9534 100644 --- a/src/datastore/plugin_datastore_postgres.c +++ b/src/datastore/plugin_datastore_postgres.c @@ -29,7 +29,6 @@ #include "gnunet_postgres_lib.h" #include -#define DEBUG_POSTGRES GNUNET_EXTRA_LOGGING /** * After how many ms "busy" should a DB operation fail for good? @@ -312,10 +311,8 @@ postgres_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, return GNUNET_SYSERR; PQclear (ret); plugin->env->duc (plugin->env->cls, size + GNUNET_DATASTORE_ENTRY_OVERHEAD); -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Stored %u bytes in database\n", (unsigned int) size); -#endif return GNUNET_OK; } @@ -349,10 +346,8 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, GNUNET_POSTGRES_check_result_ (plugin->dbh, res, PGRES_TUPLES_OK, "PQexecPrepared", "select", filename, line)) { -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Ending iteration (postgres error)\n"); -#endif proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); return; } @@ -360,10 +355,8 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, if (0 == PQntuples (res)) { /* no result */ -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Ending iteration (no more results)\n"); -#endif proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0); PQclear (res); return; @@ -398,11 +391,9 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 3)); memcpy (&key, PQgetvalue (res, 0, 4), sizeof (GNUNET_HashCode)); size = PQgetlength (res, 0, 5); -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Found result of size %u bytes and type %u in database\n", (unsigned int) size, (unsigned int) type); -#endif iret = proc (proc_cls, &key, size, PQgetvalue (res, 0, 5), (enum GNUNET_BLOCK_Type) type, priority, anonymity, expiration_time, @@ -410,23 +401,17 @@ process_result (struct Plugin *plugin, PluginDatumProcessor proc, PQclear (res); if (iret == GNUNET_NO) { -#if DEBUG_POSTGRES GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Processor asked for item %u to be removed.\n", rowid); -#endif if (GNUNET_OK == GNUNET_POSTGRES_delete_by_rowid (plugin->dbh, "delrow", rowid)) { -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Deleting %u bytes from database\n", (unsigned int) size); -#endif plugin->env->duc (plugin->env->cls, -(size + GNUNET_DATASTORE_ENTRY_OVERHEAD)); -#if DEBUG_POSTGRES GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "datastore-postgres", "Deleted %u bytes from database\n", (unsigned int) size); -#endif } } } diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index cd5ae394f..00195fb13 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c @@ -28,10 +28,6 @@ #include "gnunet_datastore_plugin.h" #include -/** - * Enable or disable logging debug messages. - */ -#define DEBUG_SQLITE GNUNET_EXTRA_LOGGING /** * We allocate items on the stack at times. To prevent a stack @@ -147,10 +143,8 @@ sq_prepare (sqlite3 * dbh, const char *zSql, sqlite3_stmt ** ppStmt) result = sqlite3_prepare_v2 (dbh, zSql, strlen (zSql), ppStmt, (const char **) &dummy); -#if DEBUG_SQLITE && 0 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Prepared `%s' / %p: %d\n", zSql, *ppStmt, result); -#endif return result; } @@ -415,10 +409,8 @@ database_shutdown (struct Plugin *plugin) stmt = sqlite3_next_stmt (plugin->dbh, NULL); while (stmt != NULL) { -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Closing statement %p\n", stmt); -#endif result = sqlite3_finalize (stmt); if (result != SQLITE_OK) GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "sqlite", @@ -502,14 +494,12 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, if (size > MAX_ITEM_SIZE) return GNUNET_SYSERR; -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Storing in database block with type %u/key `%s'/priority %u/expiration in %llu ms (%lld).\n", type, GNUNET_h2s (key), priority, (unsigned long long) GNUNET_TIME_absolute_get_remaining (expiration).rel_value, (long long) expiration.abs_value); -#endif GNUNET_CRYPTO_hash (data, size, &vhash); stmt = plugin->insertContent; rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX); @@ -540,11 +530,9 @@ sqlite_plugin_put (void *cls, const GNUNET_HashCode * key, uint32_t size, { case SQLITE_DONE: plugin->env->duc (plugin->env->cls, size + GNUNET_DATASTORE_ENTRY_OVERHEAD); -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Stored new entry (%u bytes)\n", size + GNUNET_DATASTORE_ENTRY_OVERHEAD); -#endif ret = GNUNET_OK; break; case SQLITE_BUSY: @@ -621,9 +609,7 @@ sqlite_plugin_update (void *cls, uint64_t uid, int delta, switch (n) { case SQLITE_DONE: -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Block updated\n"); -#endif return GNUNET_OK; case SQLITE_BUSY: LOG_SQLITE (plugin, msg, GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, @@ -677,11 +663,9 @@ execute_get (struct Plugin *plugin, sqlite3_stmt * stmt, break; } expiration.abs_value = sqlite3_column_int64 (stmt, 3); -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Found reply in database with expiration %llu\n", (unsigned long long) expiration.abs_value); -#endif ret = proc (proc_cls, sqlite3_column_blob (stmt, 4) /* key */ , size, sqlite3_column_blob (stmt, 5) /* data */ , sqlite3_column_int (stmt, 0) /* type */ , @@ -972,10 +956,8 @@ sqlite_plugin_get_replication (void *cls, PluginDatumProcessor proc, uint32_t repl; sqlite3_stmt *stmt; -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Getting random block based on replication order.\n"); -#endif rc.have_uid = GNUNET_NO; rc.proc = proc; rc.proc_cls = proc_cls; @@ -1061,10 +1043,8 @@ sqlite_plugin_get_expiration (void *cls, PluginDatumProcessor proc, sqlite3_stmt *stmt; struct GNUNET_TIME_Absolute now; -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Getting random block based on expiration and priority order.\n"); -#endif now = GNUNET_TIME_absolute_get (); stmt = plugin->selExpi; if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, now.abs_value)) @@ -1233,18 +1213,13 @@ libgnunet_plugin_datastore_sqlite_done (void *cls) struct GNUNET_DATASTORE_PluginFunctions *api = cls; struct Plugin *plugin = api->cls; -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "sqlite plugin is done\n"); -#endif - fn = NULL; if (plugin->drop_on_shutdown) fn = GNUNET_strdup (plugin->fn); -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "Shutting down database\n"); -#endif database_shutdown (plugin); plugin->env = NULL; GNUNET_free (api); @@ -1254,10 +1229,8 @@ libgnunet_plugin_datastore_sqlite_done (void *cls) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "unlink", fn); GNUNET_free (fn); } -#if DEBUG_SQLITE GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "sqlite", "sqlite plugin is finished\n"); -#endif return NULL; } -- cgit v1.2.3