simplify logic
authorChristian Grothoff <christian@grothoff.org>
Sun, 23 Oct 2011 14:02:52 +0000 (14:02 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 23 Oct 2011 14:02:52 +0000 (14:02 +0000)
src/core/gnunet-service-core_clients.c
src/core/gnunet-service-core_typemap.c

index b2dd675fb97933de641b8b889ecc3932d2726239..ccc76f765685577204ecc282e31c6bc779494238 100644 (file)
@@ -668,14 +668,6 @@ GSC_CLIENTS_notify_client_about_neighbour (struct GSC_Client *client,
 
   old_match = GSC_TYPEMAP_test_match (tmap_old, client->types, client->tcnt);
   new_match = GSC_TYPEMAP_test_match (tmap_new, client->types, client->tcnt);
-  if (client->tcnt == 0)
-  {
-    /* empty list matches ALL (if not NULL) */
-    if (tmap_new != NULL)
-      new_match = GNUNET_YES; 
-    if (tmap_old != NULL)
-      old_match = GNUNET_YES;
-  }
   if (old_match == new_match)
     return; /* no change */
   if (old_match == GNUNET_NO)
index 5d40820dfd731abf11c942d92800dfb39fad23b0..c54e446c67f94c7f006bbfd20c7453f15b2e614b 100644 (file)
@@ -227,6 +227,8 @@ GSC_TYPEMAP_test_match (const struct GSC_TypeMap *tmap,
 
   if (NULL == tmap)
     return GNUNET_NO;
+  if (0 == tcnt)
+    return GNUNET_YES; /* matches all */
   for (i=0;i<tcnt;i++) 
     if (0 != (tmap->bits[types[i] / 32] & (1 << (types[i] % 32))))
       return GNUNET_YES;