gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r32151 - gnunet/src/datastore


From: gnunet
Subject: [GNUnet-SVN] r32151 - gnunet/src/datastore
Date: Sun, 2 Feb 2014 18:15:37 +0100

Author: grothoff
Date: 2014-02-02 18:15:37 +0100 (Sun, 02 Feb 2014)
New Revision: 32151

Modified:
   gnunet/src/datastore/plugin_datastore_sqlite.c
Log:
-indentation, doxygen

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2014-02-02 17:11:22 UTC 
(rev 32150)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2014-02-02 17:15:37 UTC 
(rev 32151)
@@ -135,7 +135,9 @@
  * @return 0 on success
  */
 static int
-sq_prepare (sqlite3 * dbh, const char *zSql, sqlite3_stmt ** ppStmt)
+sq_prepare (sqlite3 *dbh,
+            const char *zSql,
+            sqlite3_stmt **ppStmt)
 {
   char *dummy;
   int result;
@@ -211,7 +213,7 @@
  *
  * @param cfg our configuration
  * @param plugin the plugin context (state for this module)
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 static int
 database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg,
@@ -365,6 +367,7 @@
 /**
  * Shutdown database connection and associate data
  * structures.
+ *
  * @param plugin the plugin context (state for this module)
  */
 static void
@@ -428,7 +431,8 @@
  * @param rid the ID of the row to delete
  */
 static int
-delete_by_rowid (struct Plugin *plugin, unsigned long long rid)
+delete_by_rowid (struct Plugin *plugin,
+                 unsigned long long rid)
 {
   if (SQLITE_OK != sqlite3_bind_int64 (plugin->delRow, 1, rid))
   {
@@ -462,7 +466,7 @@
  *
  * @param cls closure
  * @param key key for the item
- * @param size number of bytes in data
+ * @param size number of bytes in @a data
  * @param data content stored
  * @param type type of the content
  * @param priority priority of the content
@@ -473,10 +477,16 @@
  * @return #GNUNET_OK on success
  */
 static int
-sqlite_plugin_put (void *cls, const struct GNUNET_HashCode * key, uint32_t 
size,
-                   const void *data, enum GNUNET_BLOCK_Type type,
-                   uint32_t priority, uint32_t anonymity, uint32_t replication,
-                   struct GNUNET_TIME_Absolute expiration, char **msg)
+sqlite_plugin_put (void *cls,
+                   const struct GNUNET_HashCode *key,
+                   uint32_t size,
+                   const void *data,
+                   enum GNUNET_BLOCK_Type type,
+                   uint32_t priority,
+                   uint32_t anonymity,
+                   uint32_t replication,
+                   struct GNUNET_TIME_Absolute expiration,
+                   char **msg)
 {
   struct Plugin *plugin = cls;
   int n;
@@ -574,11 +584,14 @@
  *     MAX of any existing expiration time and
  *     this value
  * @param msg set to an error message
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
  */
 static int
-sqlite_plugin_update (void *cls, uint64_t uid, int delta,
-                      struct GNUNET_TIME_Absolute expire, char **msg)
+sqlite_plugin_update (void *cls,
+                      uint64_t uid,
+                      int delta,
+                      struct GNUNET_TIME_Absolute expire,
+                      char **msg)
 {
   struct Plugin *plugin = cls;
   int n;
@@ -624,11 +637,13 @@
  * @param plugin the plugin
  * @param stmt the statement
  * @param proc processor to call
- * @param proc_cls closure for 'proc'
+ * @param proc_cls closure for @a proc
  */
 static void
-execute_get (struct Plugin *plugin, sqlite3_stmt * stmt,
-             PluginDatumProcessor proc, void *proc_cls)
+execute_get (struct Plugin *plugin,
+             sqlite3_stmt *stmt,
+             PluginDatumProcessor proc,
+             void *proc_cls)
 {
   int n;
   struct GNUNET_TIME_Absolute expiration;
@@ -645,8 +660,7 @@
     if (sqlite3_column_bytes (stmt, 4) != sizeof (struct GNUNET_HashCode))
     {
       GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, "sqlite",
-                       _
-                       ("Invalid data in database.  Trying to fix (by 
deletion).\n"));
+                       _("Invalid data in database.  Trying to fix (by 
deletion).\n"));
       if (SQLITE_OK != sqlite3_reset (stmt))
         LOG_SQLITE (plugin, NULL,
                     GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -703,7 +717,6 @@
 }
 
 
-
 /**
  * Select a subset of the items in the datastore and call
  * the given processor for the item.
@@ -715,7 +728,7 @@
  *        Use 0 for any type.
  * @param proc function to call on each matching value;
  *        will be called once with a NULL value at the end
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  */
 static void
 sqlite_plugin_get_zero_anonymity (void *cls, uint64_t offset,
@@ -743,7 +756,6 @@
 }
 
 
-
 /**
  * Get results for a particular key in the datastore.
  *
@@ -759,12 +771,15 @@
  *     Use 0 for any type.
  * @param proc function to call on each matching value;
  *        will be called once with a NULL value at the end
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  */
 static void
-sqlite_plugin_get_key (void *cls, uint64_t offset, const struct 
GNUNET_HashCode * key,
-                       const struct GNUNET_HashCode * vhash,
-                       enum GNUNET_BLOCK_Type type, PluginDatumProcessor proc,
+sqlite_plugin_get_key (void *cls,
+                       uint64_t offset,
+                       const struct GNUNET_HashCode *key,
+                       const struct GNUNET_HashCode *vhash,
+                       enum GNUNET_BLOCK_Type type,
+                       PluginDatumProcessor proc,
                        void *proc_cls)
 {
   struct Plugin *plugin = cls;
@@ -838,20 +853,21 @@
     return;
   }
   sqoff = 1;
-  ret =
-      sqlite3_bind_blob (stmt, sqoff++, key, sizeof (struct GNUNET_HashCode),
-                         SQLITE_TRANSIENT);
+  ret = sqlite3_bind_blob (stmt, sqoff++, key,
+                           sizeof (struct GNUNET_HashCode),
+                           SQLITE_TRANSIENT);
   if ((vhash != NULL) && (ret == SQLITE_OK))
-    ret =
-        sqlite3_bind_blob (stmt, sqoff++, vhash, sizeof (struct 
GNUNET_HashCode),
-                           SQLITE_TRANSIENT);
+    ret = sqlite3_bind_blob (stmt, sqoff++, vhash,
+                             sizeof (struct GNUNET_HashCode),
+                             SQLITE_TRANSIENT);
   if ((type != 0) && (ret == SQLITE_OK))
     ret = sqlite3_bind_int (stmt, sqoff++, type);
   if (ret == SQLITE_OK)
     ret = sqlite3_bind_int64 (stmt, sqoff++, limit_off);
   if (ret != SQLITE_OK)
   {
-    LOG_SQLITE (plugin, NULL, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
+    LOG_SQLITE (plugin, NULL,
+                GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                 "sqlite_bind");
     proc (proc_cls, NULL, 0, NULL, 0, 0, 0, GNUNET_TIME_UNIT_ZERO_ABS, 0);
     return;
@@ -861,9 +877,8 @@
 }
 
 
-
 /**
- * Context for 'repl_proc' function.
+ * Context for #repl_proc() function.
  */
 struct ReplCtx
 {
@@ -874,7 +889,7 @@
   PluginDatumProcessor proc;
 
   /**
-   * Closure for proc.
+   * Closure for @e proc.
    */
   void *proc_cls;
 
@@ -891,13 +906,13 @@
 
 
 /**
- * Wrapper for the processor for 'sqlite_plugin_replication_get'.
+ * Wrapper for the processor for #sqlite_plugin_replication_get().
  * Decrements the replication counter and calls the original
  * processor.
  *
  * @param cls closure
  * @param key key for the content
- * @param size number of bytes in data
+ * @param size number of bytes in @a data
  * @param data content stored
  * @param type type of the content
  * @param priority priority of the content
@@ -905,23 +920,31 @@
  * @param expiration expiration time for the content
  * @param uid unique identifier for the datum;
  *        maybe 0 if no unique identifier is available
- *
- * @return GNUNET_OK for normal return,
- *         GNUNET_NO to delete the item
+ * @return #GNUNET_OK for normal return,
+ *         #GNUNET_NO to delete the item
  */
 static int
-repl_proc (void *cls, const struct GNUNET_HashCode * key, uint32_t size,
-           const void *data, enum GNUNET_BLOCK_Type type, uint32_t priority,
-           uint32_t anonymity, struct GNUNET_TIME_Absolute expiration,
+repl_proc (void *cls,
+           const struct GNUNET_HashCode *key,
+           uint32_t size,
+           const void *data,
+           enum GNUNET_BLOCK_Type type,
+           uint32_t priority,
+           uint32_t anonymity,
+           struct GNUNET_TIME_Absolute expiration,
            uint64_t uid)
 {
   struct ReplCtx *rc = cls;
   int ret;
 
-  ret =
-      rc->proc (rc->proc_cls, key, size, data, type, priority, anonymity,
-                expiration, uid);
-  if (key != NULL)
+  ret = rc->proc (rc->proc_cls,
+                  key,
+                  size, data,
+                  type,
+                  priority,
+                  anonymity,
+                  expiration, uid);
+  if (NULL != key)
   {
     rc->uid = uid;
     rc->have_uid = GNUNET_YES;
@@ -934,11 +957,11 @@
  * Get a random item for replication.  Returns a single random item
  * from those with the highest replication counters.  The item's
  * replication counter is decremented by one IF it was positive before.
- * Call 'proc' with all values ZERO or NULL if the datastore is empty.
+ * Call @a proc with all values ZERO or NULL if the datastore is empty.
  *
  * @param cls closure
  * @param proc function to call the value (once only).
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  */
 static void
 sqlite_plugin_get_replication (void *cls, PluginDatumProcessor proc,
@@ -1020,14 +1043,13 @@
 }
 
 
-
 /**
  * Get a random item that has expired or has low priority.
- * Call 'proc' with all values ZERO or NULL if the datastore is empty.
+ * Call @a proc with all values ZERO or NULL if the datastore is empty.
  *
  * @param cls closure
  * @param proc function to call the value (once only).
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  */
 static void
 sqlite_plugin_get_expiration (void *cls, PluginDatumProcessor proc,
@@ -1056,13 +1078,12 @@
 }
 
 
-
 /**
  * Get all of the keys in the datastore.
  *
  * @param cls closure
  * @param proc function to call on each key
- * @param proc_cls closure for proc
+ * @param proc_cls closure for @a proc
  */
 static void
 sqlite_plugin_get_keys (void *cls,
@@ -1113,7 +1134,7 @@
  * Get an estimate of how much space the database is
  * currently using.
  *
- * @param cls the 'struct Plugin'
+ * @param cls the `struct Plugin`
  * @return the size of the database on disk (estimate)
  */
 static unsigned long long
@@ -1160,7 +1181,7 @@
 /**
  * Entry point for the plugin.
  *
- * @param cls the "struct GNUNET_DATASTORE_PluginEnvironment*"
+ * @param cls the `struct GNUNET_DATASTORE_PluginEnvironment *`
  * @return NULL on error, othrewise the plugin context
  */
 void *




reply via email to

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