allow empty/NULL context message
[oweals/gnunet.git] / src / peerstore / test_peerstore_api_sync.c
index ad113a77881c10359c9df17a67b853b977555621..a09763d0575d66d837aa9b07f77a632965716170 100644 (file)
@@ -79,8 +79,8 @@ static const char *val = "test_peerstore_api_store_val";
  * @param emsg any error message
  * @return #GNUNET_YES (all good, continue)
  */
-static int
-iterate_cb (void *cls, 
+static void
+iterate_cb (void *cls,
            const struct GNUNET_PEERSTORE_Record *record,
             const char *emsg)
 {
@@ -89,15 +89,14 @@ iterate_cb (void *cls,
   GNUNET_break (NULL == emsg);
   if (NULL == record)
   {
-    GNUNET_PEERSTORE_disconnect (h, 
+    GNUNET_PEERSTORE_disconnect (h,
                                 GNUNET_NO);
     GNUNET_SCHEDULER_shutdown ();
-    return GNUNET_YES;
+    return;
   }
   rec_val = record->value;
   GNUNET_break (0 == strcmp (rec_val, val));
   ok = 0;
-  return GNUNET_YES;
 }
 
 
@@ -106,17 +105,15 @@ iterate_cb (void *cls,
  * data that should have been stored.
  *
  * @param cls NULL
- * @param tc unused
  */
 static void
-test_cont (void *cls,
-          const struct GNUNET_SCHEDULER_TaskContext *tc)
+test_cont (void *cls)
 {
   h = GNUNET_PEERSTORE_connect (cfg);
-  GNUNET_PEERSTORE_iterate (h, 
-                           subsystem, 
+  GNUNET_PEERSTORE_iterate (h,
+                           subsystem,
                            &pid, key,
-                            GNUNET_TIME_UNIT_FOREVER_REL, 
+                            GNUNET_TIME_UNIT_FOREVER_REL,
                            &iterate_cb, NULL);
 }
 
@@ -128,15 +125,15 @@ static void
 test1 ()
 {
   h = GNUNET_PEERSTORE_connect (cfg);
-  GNUNET_PEERSTORE_store (h, 
+  GNUNET_PEERSTORE_store (h,
                          subsystem,
-                         &pid, 
-                         key, 
+                         &pid,
+                         key,
                          val, strlen (val) + 1,
                           GNUNET_TIME_UNIT_FOREVER_ABS,
-                          GNUNET_PEERSTORE_STOREOPTION_REPLACE, 
+                          GNUNET_PEERSTORE_STOREOPTION_REPLACE,
                          NULL, NULL);
-  GNUNET_PEERSTORE_disconnect (h, 
+  GNUNET_PEERSTORE_disconnect (h,
                               GNUNET_YES);
   h = NULL;
   /* We need to wait a little bit to give the disconnect
@@ -158,12 +155,11 @@ test1 ()
  * @param peer handle to our peer (unused)
  */
 static void
-run (void *cls, 
+run (void *cls,
      const struct GNUNET_CONFIGURATION_Handle *c,
      struct GNUNET_TESTING_Peer *peer)
 {
   cfg = c;
-  GNUNET_assert (NULL != h);
   memset (&pid, 1, sizeof (pid));
   test1 ();
 }
@@ -173,7 +169,7 @@ int
 main (int argc, char *argv[])
 {
   if (0 !=
-      GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync", 
+      GNUNET_TESTING_service_run ("test-gnunet-peerstore-sync",
                                  "peerstore",
                                   "test_peerstore_api_data.conf",
                                  &run, NULL))