diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-11-01 20:47:52 +0000 |
commit | 652e89b59ed2207c2c12172fdabcd6e659995c81 (patch) | |
tree | f054c819d483c1056e18c1099afd4c7fcd2582a0 /src/util/container_multihashmap.c | |
parent | 5e4113e83368849500792e57946c3d8dd9e548d8 (diff) | |
download | gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.tar.gz gnunet-652e89b59ed2207c2c12172fdabcd6e659995c81.zip |
fixing bio testcase and a bug in bio.c, also indenting
Diffstat (limited to 'src/util/container_multihashmap.c')
-rw-r--r-- | src/util/container_multihashmap.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index 2c88b1a52..e291b8b50 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -199,8 +199,7 @@ GNUNET_CONTAINER_multihashmap_iterate (const struct | |||
199 | e = map->map[i]; | 199 | e = map->map[i]; |
200 | while (e != NULL) | 200 | while (e != NULL) |
201 | { | 201 | { |
202 | if ( (NULL != it) && | 202 | if ((NULL != it) && (GNUNET_OK != it (it_cls, &e->key, e->value))) |
203 | (GNUNET_OK != it (it_cls, &e->key, e->value)) ) | ||
204 | return GNUNET_SYSERR; | 203 | return GNUNET_SYSERR; |
205 | count++; | 204 | count++; |
206 | e = e->next; | 205 | e = e->next; |
@@ -235,8 +234,8 @@ GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap | |||
235 | e = map->map[i]; | 234 | e = map->map[i]; |
236 | while (e != NULL) | 235 | while (e != NULL) |
237 | { | 236 | { |
238 | if ( (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && | 237 | if ((0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) && |
239 | (value == e->value)) | 238 | (value == e->value)) |
240 | { | 239 | { |
241 | if (p == NULL) | 240 | if (p == NULL) |
242 | map->map[i] = e->next; | 241 | map->map[i] = e->next; |
@@ -354,7 +353,7 @@ grow (struct GNUNET_CONTAINER_MultiHashMap *map) | |||
354 | while (NULL != (e = old_map[i])) | 353 | while (NULL != (e = old_map[i])) |
355 | { | 354 | { |
356 | old_map[i] = e->next; | 355 | old_map[i] = e->next; |
357 | idx = idx_of (map, &e->key); | 356 | idx = idx_of (map, &e->key); |
358 | e->next = new_map[idx]; | 357 | e->next = new_map[idx]; |
359 | new_map[idx] = e; | 358 | new_map[idx] = e; |
360 | } | 359 | } |
@@ -386,8 +385,8 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
386 | unsigned int i; | 385 | unsigned int i; |
387 | 386 | ||
388 | i = idx_of (map, key); | 387 | i = idx_of (map, key); |
389 | if ( (opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE) && | 388 | if ((opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE) && |
390 | (opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST) ) | 389 | (opt != GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
391 | { | 390 | { |
392 | e = map->map[i]; | 391 | e = map->map[i]; |
393 | while (e != NULL) | 392 | while (e != NULL) |
@@ -405,7 +404,7 @@ GNUNET_CONTAINER_multihashmap_put (struct GNUNET_CONTAINER_MultiHashMap *map, | |||
405 | if (map->size / 3 >= map->map_length / 4) | 404 | if (map->size / 3 >= map->map_length / 4) |
406 | { | 405 | { |
407 | grow (map); | 406 | grow (map); |
408 | i = idx_of (map, key); | 407 | i = idx_of (map, key); |
409 | } | 408 | } |
410 | e = GNUNET_malloc (sizeof (struct MapEntry)); | 409 | e = GNUNET_malloc (sizeof (struct MapEntry)); |
411 | e->key = *key; | 410 | e->key = *key; |
@@ -443,8 +442,7 @@ GNUNET_CONTAINER_multihashmap_get_multiple (const struct | |||
443 | { | 442 | { |
444 | if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) | 443 | if (0 == memcmp (key, &e->key, sizeof (GNUNET_HashCode))) |
445 | { | 444 | { |
446 | if ( (it != NULL) && | 445 | if ((it != NULL) && (GNUNET_OK != it (it_cls, &e->key, e->value))) |
447 | (GNUNET_OK != it (it_cls, &e->key, e->value)) ) | ||
448 | return GNUNET_SYSERR; | 446 | return GNUNET_SYSERR; |
449 | count++; | 447 | count++; |
450 | } | 448 | } |