diff options
author | Matt Turner <mattst88@gmail.com> | 2008-11-17 00:27:58 +0000 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2008-11-17 00:27:58 +0000 |
commit | c5d434d9437537f69453ff7e7ca1607da87cfd02 (patch) | |
tree | 3921aa63954b5dd7ce92ca7b944be6fc29149aae | |
parent | 1df846b3f94aa7ca9a6622577c367c864131bd04 (diff) |
Convert a while(1) ... break loop into a do while
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@66 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r-- | stringsort.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/stringsort.c b/stringsort.c index 5f47528..ed8c913 100644 --- a/stringsort.c +++ b/stringsort.c @@ -56,7 +56,7 @@ DoStringSort(void) unsigned char* array = NULL; clock_t total_time = 0; int iterations = 0; - static int num_arrays = 1; + static int num_arrays = 0; static bool is_adjusted = false; if (is_adjusted == false) { @@ -64,7 +64,8 @@ DoStringSort(void) /* ** Initialize the number of arrays. */ - while (1) { + do { + ++num_arrays; /* ** Allocate space for array. We'll add an extra 100 ** bytes to protect memory as strings move around @@ -82,12 +83,7 @@ DoStringSort(void) ** minimum, then de-allocate the array, reallocate a ** an additional array, and try again. */ - if (DoStringSortIteration(array, num_arrays) > MINIMUM_TICKS) { - break; - } - - ++num_arrays; - } + } while (DoStringSortIteration(array, num_arrays) <= MINIMUM_TICKS); } else { /* ** We don't have to perform self adjustment code. |