rename element's type field to 'element_type'
authorChristian Grothoff <christian@grothoff.org>
Thu, 27 Nov 2014 10:04:14 +0000 (10:04 +0000)
committerChristian Grothoff <christian@grothoff.org>
Thu, 27 Nov 2014 10:04:14 +0000 (10:04 +0000)
15 files changed:
src/consensus/consensus_api.c
src/consensus/gnunet-service-consensus.c
src/dv/gnunet-service-dv.c
src/include/gnunet_set_service.h
src/revocation/gnunet-service-revocation.c
src/scalarproduct/gnunet-service-scalarproduct.c
src/secretsharing/gnunet-service-secretsharing.c
src/set/gnunet-service-set.c
src/set/gnunet-service-set_intersection.c
src/set/gnunet-service-set_union.c
src/set/gnunet-set-profiler.c
src/set/set_api.c
src/set/test_set_api.c
src/set/test_set_intersection_result_full.c
src/set/test_set_union_result_full.c

index 6988c7b6d3425ff2cdeeae95530a2be3c1c73b2f..7b52c20410061996aacda53cbb6aab4445ce96a8 100644 (file)
@@ -116,9 +116,10 @@ handle_new_element (void *cls,
       = (const struct GNUNET_CONSENSUS_ElementMessage *) mh;
   struct GNUNET_SET_Element element;
 
-  LOG (GNUNET_ERROR_TYPE_DEBUG, "received new element\n");
+  LOG (GNUNET_ERROR_TYPE_DEBUG,
+       "received new element\n");
 
-  element.type = msg->element_type;
+  element.element_type = msg->element_type;
   element.size = ntohs (msg->header.size) - sizeof (struct GNUNET_CONSENSUS_ElementMessage);
   element.data = &msg[1];
 
index adf81ac17941234b8fe117f945b62a4a44d790e1..2659b939dc39154c6cad64d9652a634c3330f900 100644 (file)
@@ -377,12 +377,12 @@ destroy_session (struct ConsensusSession *session)
 
 
 /**
- * Iterator for set elements.
+ * Iterator for set elements. [FIXME: bad comment]
  *
  * @param cls closure
  * @param element the current element, NULL if all elements have been
  *        iterated over
- * @return GNUNET_YES to continue iterating, GNUNET_NO to stop.
+ * @return #GNUNET_YES to continue iterating, #GNUNET_NO to stop.
  */
 static int
 send_to_client_iter (void *cls,
@@ -395,17 +395,20 @@ send_to_client_iter (void *cls,
   {
     struct GNUNET_CONSENSUS_ElementMessage *m;
 
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: got element for client\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "P%d: got element for client\n",
                 session->local_peer_idx);
 
-    ev = GNUNET_MQ_msg_extra (m, element->size, GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
-    m->element_type = htons (element->type);
+    ev = GNUNET_MQ_msg_extra (m, element->size,
+                              GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_RECEIVED_ELEMENT);
+    m->element_type = htons (element->element_type);
     memcpy (&m[1], element->data, element->size);
     GNUNET_MQ_send (session->client_mq, ev);
   }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "P%d: finished iterating elements for client\n",
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "P%d: finished iterating elements for client\n",
                 session->local_peer_idx);
     ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_CONCLUDE_DONE);
     GNUNET_MQ_send (session->client_mq, ev);
@@ -1252,7 +1255,7 @@ client_insert (void *cls,
   }
 
   element = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) + element_size);
-  element->type = msg->element_type;
+  element->element_type = msg->element_type;
   element->size = element_size;
   memcpy (&element[1], &msg[1], element_size);
   element->data = &element[1];
index ad00264d0d0481f4e0f694a9f34ebb76468b9683..478c0cc1202e524ea17d4f11587a80f793bdfed2 100644 (file)
@@ -852,7 +852,7 @@ build_set (void *cls)
   target = &route->target;
   GNUNET_assert (ntohl (target->distance) < DEFAULT_FISHEYE_DEPTH);
   element.size = sizeof (struct Target);
-  element.type = htons (0); /* do we need this? */
+  element.element_type = htons (0);
   element.data = target;
 
   /* Find next non-NULL entry */
index 1ff8d85d5cc98b36bcb536214cdbac354f9b6ac8..c0e65cb72cd8616efe6fabab11ed369c35a990f2 100644 (file)
@@ -161,7 +161,7 @@ struct GNUNET_SET_Element
   /**
    * Application-specific element type.
    */
-  uint16_t type;
+  uint16_t element_type;
 
   /**
    * Actual data of the element
index 0c75c14c35a24a0db58facf4022e56e45716ce67..7ef5cbc817daab9c7a15bdc270499f1bd6dfdb0e 100644 (file)
@@ -268,8 +268,8 @@ publicize_rm (const struct RevokeMessage *rm)
       GNUNET_CONTAINER_multihashmap_contains (revocation_map,
                                               &hc))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                _("Duplicate revocation received from peer. Ignored.\n"));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                "Duplicate revocation received from peer. Ignored.\n");
     return GNUNET_OK;
   }
   if (GNUNET_OK !=
@@ -304,7 +304,7 @@ publicize_rm (const struct RevokeMessage *rm)
                                                    GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   /* add to set for future connections */
   e.size = htons (rm->header.size);
-  e.type = 0;
+  e.element_type = 0;
   e.data = rm;
   if (GNUNET_OK !=
       GNUNET_SET_add_element (revocation_set,
@@ -413,7 +413,7 @@ add_revocation (void *cls,
       GNUNET_break_op (0);
       return;
     }
-    if (0 != element->type)
+    if (0 != element->element_type)
     {
       GNUNET_STATISTICS_update (stats,
                                 "# unsupported revocations received via set union",
index 07eb565fbb065d2e0693c0b15bf4d5ab0a9547bf..170bf89a6608f2e9e71f71a68e164e3d0c4b0464 100644 (file)
@@ -1699,7 +1699,7 @@ handle_client_message_multipart (void *cls,
     }
     set_elem.data = &elem->key;
     set_elem.size = sizeof (elem->key);
-    set_elem.type = 0; /* do we REALLY need this? */
+    set_elem.element_type = 0; /* do we REALLY need this? */
     GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL);
     s->used_element_count++;
   }
@@ -1812,7 +1812,7 @@ handle_client_message (void *cls,
     }
     set_elem.data = &elem->key;
     set_elem.size = sizeof (elem->key);
-    set_elem.type = 0; /* do we REALLY need this? */
+    set_elem.element_type = 0;
     GNUNET_SET_add_element (s->intersection_set, &set_elem, NULL, NULL);
     s->used_element_count++;
   }
index ebf0789826224b0b0ea43a66f5c3dab3edde8936..3a0461008bc07fb9efdf51e1be55038da7077124 100644 (file)
@@ -2028,7 +2028,7 @@ insert_decrypt_element (struct DecryptSession *ds)
 
   element.data = (void *) &d;
   element.size = sizeof (struct GNUNET_SECRETSHARING_DecryptData);
-  element.type = 0;
+  element.element_type = 0;
 
   d.ciphertext = ds->ciphertext;
   d.peer = my_peer;
index 452ded8a39e10969d40b9c3f882bc6bc3f2601b9..b050cb465d67088e2e4381d37c08ebe2a1ce0167 100644 (file)
@@ -694,7 +694,7 @@ send_client_element (struct Set *set)
                               ee->element.size,
                               GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT);
     memcpy (&msg[1], ee->element.data, ee->element.size);
-    msg->element_type = ee->element.type;
+    msg->element_type = ee->element.element_type;
   }
   GNUNET_MQ_send (set->client_mq, ev);
 }
index 60677615427cf2f6597c785696f94c41ef7fe1e7..4a252f4be8ac70846ee53f1c7ca5fadc9facb005 100644 (file)
@@ -181,7 +181,7 @@ send_client_element (struct Operation *op,
   }
   rm->result_status = htons (GNUNET_SET_STATUS_OK);
   rm->request_id = htonl (op->spec->client_request_id);
-  rm->element_type = element->type;
+  rm->element_type = element->element_type;
   memcpy (&rm[1], element->data, element->size);
   GNUNET_MQ_send (op->spec->set->client_mq, ev);
 }
@@ -572,7 +572,7 @@ send_remaining_elements (void *cls)
 
   rm->result_status = htons (GNUNET_SET_STATUS_OK);
   rm->request_id = htonl (op->spec->client_request_id);
-  rm->element_type = element->type;
+  rm->element_type = element->element_type;
   memcpy (&rm[1], element->data, element->size);
 
   GNUNET_MQ_notify_sent (ev, send_remaining_elements, op);
index 77e8502d68f640416ded47b388f7528a6831412f..10ad1c545a900a84d6bf9b37f4219fa3f7ebdb59 100644 (file)
@@ -965,7 +965,7 @@ send_client_element (struct Operation *op,
   }
   rm->result_status = htons (GNUNET_SET_STATUS_OK);
   rm->request_id = htonl (op->spec->client_request_id);
-  rm->element_type = element->type;
+  rm->element_type = element->element_type;
   memcpy (&rm[1], element->data, element->size);
   GNUNET_MQ_send (op->spec->set->client_mq, ev);
 }
@@ -1036,7 +1036,7 @@ send_remaining_elements (void *cls)
     }
     rm->result_status = htons (GNUNET_SET_STATUS_OK);
     rm->request_id = htonl (op->spec->client_request_id);
-    rm->element_type = element->type;
+    rm->element_type = element->element_type;
     memcpy (&rm[1], element->data, element->size);
     if (ke->next_colliding == NULL)
     {
index f1b7b4b14bc0290e985774c97aac0cfe393f3e3b..3bff452544ff923806ace4723f1083fed9030593 100644 (file)
@@ -143,18 +143,19 @@ set_listen_cb (void *cls,
 {
   if (NULL == request)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "listener failed\n");
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "listener failed\n");
     return;
   }
   GNUNET_assert (NULL == info2.oh);
-  GNUNET_log (GNUNET_ERROR_TYPE_INFO, "set listen cb called\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "set listen cb called\n");
   info2.oh = GNUNET_SET_accept (request, GNUNET_SET_RESULT_ADDED,
                                set_result_cb, &info2);
   GNUNET_SET_commit (info2.oh, info2.set);
 }
 
 
-
 static int
 set_insert_iterator (void *cls,
                      const struct GNUNET_HashCode *key,
@@ -163,8 +164,9 @@ set_insert_iterator (void *cls,
   struct GNUNET_SET_Handle *set = cls;
   struct GNUNET_SET_Element *el;
 
-  el = GNUNET_malloc (sizeof *el + sizeof *key);
-  el->type = 0;
+  el = GNUNET_malloc (sizeof (struct GNUNET_SET_Element) +
+                      sizeof (struct GNUNET_HashCode));
+  el->element_type = 0;
   memcpy (&el[1], key, sizeof *key);
   el->data = &el[1];
   el->size = sizeof *key;
@@ -205,6 +207,7 @@ handle_shutdown (void *cls,
   }
 }
 
+
 static void
 run (void *cls, char *const *args, const char *cfgfile,
      const struct GNUNET_CONFIGURATION_Handle *cfg)
index 10421ebdaaf9c989e7b6bbe1a0f430d09cd8ac7d..1ef0cc50c8061d8d8995ac749febbb173cee8355 100644 (file)
@@ -234,7 +234,7 @@ handle_iter_element (void *cls, const struct GNUNET_MessageHeader *mh)
     return;
 
   element.size = ntohs (mh->size) - sizeof (struct GNUNET_SET_IterResponseMessage);
-  element.type = htons (msg->element_type);
+  element.element_type = htons (msg->element_type);
   element.data = &msg[1];
   set->iterator (set->iterator_cls, &element);
   ev = GNUNET_MQ_msg (ack_msg, GNUNET_MESSAGE_TYPE_SET_ITER_ACK);
@@ -306,7 +306,7 @@ handle_result (void *cls, const struct GNUNET_MessageHeader *mh)
 
   e.data = &msg[1];
   e.size = ntohs (mh->size) - sizeof (struct GNUNET_SET_ResultMessage);
-  e.type = msg->element_type;
+  e.element_type = msg->element_type;
   if (NULL != oh->result_cb)
     oh->result_cb (oh->result_cls, &e, result_status);
 }
@@ -552,7 +552,7 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
   }
 
   mqm = GNUNET_MQ_msg_extra (msg, element->size, GNUNET_MESSAGE_TYPE_SET_ADD);
-  msg->element_type = element->type;
+  msg->element_type = element->element_type;
   memcpy (&msg[1], element->data, element->size);
   GNUNET_MQ_notify_sent (mqm, cont, cont_cls);
   GNUNET_MQ_send (set->mq, mqm);
@@ -569,8 +569,8 @@ GNUNET_SET_add_element (struct GNUNET_SET_Handle *set,
  * @param set set to remove element from
  * @param element element to remove from the set
  * @param cont continuation called after the element has been removed
- * @param cont_cls closure for cont
- * @return GNUNET_OK on success, GNUNET_SYSERR if the
+ * @param cont_cls closure for @a cont
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the
  *         set is invalid (e.g. the set service crashed)
  */
 int
@@ -590,7 +590,7 @@ GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set,
   }
 
   mqm = GNUNET_MQ_msg_extra (msg, element->size, GNUNET_MESSAGE_TYPE_SET_REMOVE);
-  msg->element_type = element->type;
+  msg->element_type = element->element_type;
   memcpy (&msg[1], element->data, element->size);
   GNUNET_MQ_notify_sent (mqm, cont, cont_cls);
   GNUNET_MQ_send (set->mq, mqm);
index 63188eb6058faa692d43c885d51a8c6dc66360fc..37645cbd80fc70f029b6a084d9f3f36d1df371dd 100644 (file)
@@ -149,7 +149,7 @@ init_set2 (void *cls)
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);
@@ -171,7 +171,7 @@ init_set1 (void)
 {
   struct GNUNET_SET_Element element;
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);
@@ -208,7 +208,7 @@ test_iter ()
 
   iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_UNION);
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);
index 3b4591bed8ce27746ca99461637387a1cec678c5..567a2ed0d2d23aa97d8dd7b7f88df2fb214315b0 100644 (file)
@@ -152,7 +152,7 @@ init_set2 (void *cls)
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "initializing set 2\n");
-  element.type = 0;
+  element.element_type = 0;
   element.data = "hello";
   element.size = strlen(element.data);
   GNUNET_SET_add_element (set2, &element, NULL, NULL);
@@ -173,7 +173,7 @@ init_set1 (void)
 {
   struct GNUNET_SET_Element element;
 
-  element.type = 0;
+  element.element_type = 0;
   element.data = "hello";
   element.size = strlen(element.data);
   GNUNET_SET_add_element (set1, &element, NULL, NULL);
@@ -205,7 +205,7 @@ test_iter ()
   struct GNUNET_SET_Handle *iter_set;
 
   iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_INTERSECTION);
-  element.type = 0;
+  element.element_type = 0;
   element.data = "hello";
   element.size = strlen(element.data);
   GNUNET_SET_add_element (iter_set, &element, NULL, NULL);
index 1ed7c7bee5ff85631c745dc818ea6bf6aa50e86e..f3f389dd01c5bf0244610bd1f87c9f2a1da1d9a5 100644 (file)
@@ -150,7 +150,7 @@ init_set2 (void *cls)
 
   GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n");
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);
@@ -172,7 +172,7 @@ init_set1 (void)
 {
   struct GNUNET_SET_Element element;
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);
@@ -209,7 +209,7 @@ test_iter ()
 
   iter_set = GNUNET_SET_create (config, GNUNET_SET_OPERATION_UNION);
 
-  element.type = 0;
+  element.element_type = 0;
 
   element.data = "hello";
   element.size = strlen(element.data);