diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-08-15 12:43:16 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-08-15 12:43:16 +0000 |
commit | e1f5c1726ef0037dd836c68266fe8a4e88f196ca (patch) | |
tree | 66ea828de93b124db5385c8a72681668f64bcd65 | |
parent | dc9e56c0bad628485c7acc319b4330a4f9907743 (diff) | |
download | gnunet-gtk-e1f5c1726ef0037dd836c68266fe8a4e88f196ca.tar.gz gnunet-gtk-e1f5c1726ef0037dd836c68266fe8a4e88f196ca.zip |
some code cleanup
-rw-r--r-- | src/lib/eventloop.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/eventloop.c b/src/lib/eventloop.c index 901aaaf3..507ce315 100644 --- a/src/lib/eventloop.c +++ b/src/lib/eventloop.c | |||
@@ -342,21 +342,19 @@ gnunet_gtk_select (void *cls, | |||
342 | #else | 342 | #else |
343 | while (1) | 343 | while (1) |
344 | { | 344 | { |
345 | fd_counter = 0; | ||
346 | struct GNUNET_CONTAINER_SList_Iterator *t; | 345 | struct GNUNET_CONTAINER_SList_Iterator *t; |
346 | |||
347 | fd_counter = 0; | ||
347 | /* We might overshoot a little, but that won't hurt very much */ | 348 | /* We might overshoot a little, but that won't hurt very much */ |
348 | int need_nfds = (rfds->sds.fd_count + rfds->sds.fd_count + rfds->sds.fd_count > 0 ? 3 : 0) | 349 | int need_nfds = (rfds->sds.fd_count + rfds->sds.fd_count + rfds->sds.fd_count > 0 ? 3 : 0) |
349 | + (rfds == NULL ? 0 : GNUNET_CONTAINER_slist_count (rfds->handles)) | 350 | + (rfds == NULL ? 0 : GNUNET_CONTAINER_slist_count (rfds->handles)) |
350 | + (wfds == NULL ? 0 : 1) | 351 | + (wfds == NULL ? 0 : 1) |
351 | + 1; | 352 | + 1; |
352 | if (need_nfds >= ml->cached_poll_array_size) | 353 | if (need_nfds >= ml->cached_poll_array_size) |
353 | { | 354 | resize_cached_poll_array (ml, need_nfds * 2); |
354 | /* Since there are also gmainloop's own fds, just need_nfds won't be | 355 | /* Since there are also gmainloop's own fds, just need_nfds won't be |
355 | * enough, so make it twice as long. | 356 | * enough, so make it twice as long. |
356 | */ | 357 | */ |
357 | ml->cached_poll_array = ml->cached_poll_array = g_renew (GPollFD, ml->cached_poll_array, need_nfds * 2); | ||
358 | ml->cached_poll_array_size = ml->cached_poll_array_size = need_nfds * 2; | ||
359 | } | ||
360 | if (ml->read_array_length < GNUNET_CONTAINER_slist_count (rfds->handles)) | 358 | if (ml->read_array_length < GNUNET_CONTAINER_slist_count (rfds->handles)) |
361 | { | 359 | { |
362 | ml->read_array = GNUNET_realloc (ml->read_array, | 360 | ml->read_array = GNUNET_realloc (ml->read_array, |