-indentation
[oweals/gnunet.git] / src / transport / gnunet-service-transport_hello.c
index 6bf7077558604a02ce4304961e87c4e93c76e956..49992222da31d287bc5cb8073cd06e29cca27f5e 100644 (file)
@@ -133,17 +133,18 @@ struct GeneratorContext
  * @param cls the 'struct GeneratorContext'
  * @param max maximum number of bytes left
  * @param buf where to write the address
+ * @return bytes written or GNUNET_SYSERR to signal the
+ *         end of the iteration.
  */
-static size_t
+static ssize_t
 address_generator (void *cls, size_t max, void *buf)
 {
   struct GeneratorContext *gc = cls;
-  size_t ret;
+  ssize_t ret;
 
   if (NULL == gc->addr_pos)
-    return 0;
-  ret =
-      GNUNET_HELLO_add_address (gc->addr_pos->address, gc->expiration, buf,
+    return GNUNET_SYSERR; /* Done */
+  ret = GNUNET_HELLO_add_address (gc->addr_pos->address, gc->expiration, buf,
                                 max);
   gc->addr_pos = gc->addr_pos->next;
   return ret;
@@ -288,7 +289,7 @@ GST_hello_modify_addresses (int addremove,
     GNUNET_break (0);
     return;
   }
-  al = GNUNET_malloc (sizeof (struct OwnAddressList));
+  al = GNUNET_new (struct OwnAddressList);
   GNUNET_CONTAINER_DLL_insert (oal_head, oal_tail, al);
   al->address = GNUNET_HELLO_address_copy (address);
   refresh_hello ();