-fix format warning
[oweals/gnunet.git] / src / peerinfo / peerinfo_api.c
index 20042f8e3ee262b8136e47fd2055a3adbb491854..0637eda7297782e9228b9e2a59adb08836b46da5 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet.
-     (C) 2001-2014 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2001-2014 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -59,7 +59,7 @@ struct GNUNET_PEERINFO_AddContext
   GNUNET_PEERINFO_Continuation cont;
 
   /**
-   * Closure for 'cont'.
+   * Closure for @e cont.
    */
   void *cont_cls;
 
@@ -110,7 +110,7 @@ struct GNUNET_PEERINFO_IteratorContext
   /**
    * Task responsible for timeout.
    */
-  GNUNET_SCHEDULER_TaskIdentifier timeout_task;
+  struct GNUNET_SCHEDULER_Task *timeout_task;
 
   /**
    * Timeout for the operation.
@@ -179,7 +179,7 @@ struct GNUNET_PEERINFO_Handle
   /**
    * ID for a reconnect task.
    */
-  GNUNET_SCHEDULER_TaskIdentifier r_task;
+  struct GNUNET_SCHEDULER_Task *r_task;
 
   /**
    * Are we now receiving?
@@ -247,10 +247,10 @@ GNUNET_PEERINFO_disconnect (struct GNUNET_PEERINFO_Handle *h)
     GNUNET_CLIENT_disconnect (h->client);
     h->client = NULL;
   }
-  if (GNUNET_SCHEDULER_NO_TASK != h->r_task)
+  if (NULL != h->r_task)
   {
     GNUNET_SCHEDULER_cancel (h->r_task);
-    h->r_task = GNUNET_SCHEDULER_NO_TASK;
+    h->r_task = NULL;
   }
   GNUNET_free (h);
 }
@@ -279,15 +279,13 @@ reconnect (struct GNUNET_PEERINFO_Handle *h);
  * Task scheduled to re-try connecting to the peerinfo service.
  *
  * @param cls the `struct GNUNET_PEERINFO_Handle *`
- * @param tc scheduler context
  */
 static void
-reconnect_task (void *cls,
-                const struct GNUNET_SCHEDULER_TaskContext *tc)
+reconnect_task (void *cls)
 {
   struct GNUNET_PEERINFO_Handle *h = cls;
 
-  h->r_task = GNUNET_SCHEDULER_NO_TASK;
+  h->r_task = NULL;
   reconnect (h);
 }
 
@@ -300,10 +298,10 @@ reconnect_task (void *cls,
 static void
 reconnect (struct GNUNET_PEERINFO_Handle *h)
 {
-  if (GNUNET_SCHEDULER_NO_TASK != h->r_task)
+  if (NULL != h->r_task)
   {
     GNUNET_SCHEDULER_cancel (h->r_task);
-    h->r_task = GNUNET_SCHEDULER_NO_TASK;
+    h->r_task = NULL;
   }
   if (NULL != h->th)
   {
@@ -430,8 +428,8 @@ trigger_transmit (struct GNUNET_PEERINFO_Handle *h)
  * @return handle to cancel add operation; all pending
  *         'add' operations will be cancelled automatically
  *        on disconnect, so it is not necessary to keep this
- *        handle (unless 'cont' is NULL and at some point
- *        calling 'cont' must be prevented)
+ *        handle (unless @a cont is NULL and at some point
+ *        calling @a cont must be prevented)
  */
 struct GNUNET_PEERINFO_AddContext *
 GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
@@ -445,10 +443,9 @@ GNUNET_PEERINFO_add_peer (struct GNUNET_PEERINFO_Handle *h,
 
   GNUNET_assert (GNUNET_OK == GNUNET_HELLO_get_id (hello, &peer));
   LOG (GNUNET_ERROR_TYPE_DEBUG,
-       "Adding peer `%s' to PEERINFO database (%u bytes of `%s')\n",
+       "Adding peer `%s' to PEERINFO database (%u bytes of HELLO)\n",
        GNUNET_i2s (&peer),
-       hs,
-       "HELLO");
+       hs);
   ac = GNUNET_malloc (sizeof (struct GNUNET_PEERINFO_AddContext) + hs);
   ac->h = h;
   ac->size = hs;
@@ -699,17 +696,15 @@ iterator_start_receive (void *cls,
  * Peerinfo iteration request has timed out.
  *
  * @param cls the `struct GNUNET_PEERINFO_IteratorContext *`
- * @param tc scheduler context
  */
 static void
-signal_timeout (void *cls,
-                const struct GNUNET_SCHEDULER_TaskContext *tc)
+signal_timeout (void *cls)
 {
   struct GNUNET_PEERINFO_IteratorContext *ic = cls;
   GNUNET_PEERINFO_Processor cb;
   void *cb_cls;
 
-  ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+  ic->timeout_task = NULL;
   cb = ic->callback;
   cb_cls = ic->callback_cls;
   GNUNET_PEERINFO_iterate_cancel (ic);
@@ -791,7 +786,9 @@ GNUNET_PEERINFO_iterate (struct GNUNET_PEERINFO_Handle *h,
       GNUNET_SCHEDULER_add_delayed (timeout, &signal_timeout, ic);
   ac->cont = &iterator_start_receive;
   ac->cont_cls = ic;
-  GNUNET_CONTAINER_DLL_insert_tail (h->ac_head, h->ac_tail, ac);
+  GNUNET_CONTAINER_DLL_insert_tail (h->ac_head,
+                                   h->ac_tail,
+                                   ac);
   GNUNET_CONTAINER_DLL_insert_tail (h->ic_head,
                                    h->ic_tail,
                                    ic);
@@ -811,10 +808,10 @@ GNUNET_PEERINFO_iterate_cancel (struct GNUNET_PEERINFO_IteratorContext *ic)
   struct GNUNET_PEERINFO_Handle *h;
 
   h = ic->h;
-  if (GNUNET_SCHEDULER_NO_TASK != ic->timeout_task)
+  if (NULL != ic->timeout_task)
   {
     GNUNET_SCHEDULER_cancel (ic->timeout_task);
-    ic->timeout_task = GNUNET_SCHEDULER_NO_TASK;
+    ic->timeout_task = NULL;
   }
   ic->callback = NULL;
   if (GNUNET_YES == ic->request_transmitted)