From c5d434d9437537f69453ff7e7ca1607da87cfd02 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 17 Nov 2008 00:27:58 +0000 Subject: 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 --- stringsort.c | 12 ++++-------- 1 file 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. -- cgit v1.2.3