From: Frederic Suter Date: Mon, 25 Jan 2016 15:06:37 +0000 (+0100) Subject: uncovered code in test is dead code. kill! X-Git-Tag: v3_13~1086 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5a1a25a87636041e2863cfb26b85c19c3a3d2ca6?ds=sidebyside uncovered code in test is dead code. kill! --- diff --git a/examples/msg/chainsend/iterator.c b/examples/msg/chainsend/iterator.c index 70956eae1b..2d0eccc271 100644 --- a/examples/msg/chainsend/iterator.c +++ b/examples/msg/chainsend/iterator.c @@ -7,27 +7,6 @@ #include "iterator.h" /* http://stackoverflow.com/a/3348142 */ -static int rand_int(int n) -{ - int limit = RAND_MAX - RAND_MAX % n; - int rnd; - - do { - rnd = rand(); - } while (rnd >= limit); - - return rnd % n; -} - -void xbt_dynar_shuffle_in_place(xbt_dynar_t indices_list) -{ - int i, j; - - for (i = xbt_dynar_length(indices_list) - 1; i > 0; i--) { - j = rand_int(i + 1); - xbt_dynar_swap_elements(indices_list, int, i, j); - } -} /**************************************/ /* Allocates and initializes a new xbt_dynar iterator for list, using criteria_fn as iteration criteria @@ -45,18 +24,6 @@ xbt_dynar_iterator_t xbt_dynar_iterator_new(xbt_dynar_t list, xbt_dynar_t (*crit return it; } -void xbt_dynar_iterator_reset(xbt_dynar_iterator_t it) -{ - xbt_dynar_free_container(&(it->indices_list)); - it->indices_list = it->criteria_fn(it->length); - it->current = 0; -} - -void xbt_dynar_iterator_seek(xbt_dynar_iterator_t it, int pos) -{ - it->current = pos; -} - /* Returns the next element iterated by iterator it, NULL if there are no more elements */ void *xbt_dynar_iterator_next(xbt_dynar_iterator_t it) { @@ -84,19 +51,3 @@ xbt_dynar_t forward_indices_list(int size) xbt_dynar_push_as(indices_list, int, i); return indices_list; } - -xbt_dynar_t reverse_indices_list(int size) -{ - xbt_dynar_t indices_list = xbt_dynar_new(sizeof(int), NULL); - int i; - for (i = size-1; i >= 0; i--) - xbt_dynar_push_as(indices_list, int, i); - return indices_list; -} - -xbt_dynar_t random_indices_list(int size) -{ - xbt_dynar_t indices_list = forward_indices_list(size); - xbt_dynar_shuffle_in_place(indices_list); - return indices_list; -}