From 625ae827c8d413473ee957e7f07b9f67120a9678 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 17 Nov 2008 00:46:33 +0000 Subject: Convert while(1) loop to do while git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@71 0d43b9a7-5ab2-4d7b-af9d-f64450cef757 --- assignment.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/assignment.c b/assignment.c index 6d653ca..cf0edf7 100644 --- a/assignment.c +++ b/assignment.c @@ -74,7 +74,7 @@ DoAssign(void) long* 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) { @@ -85,7 +85,9 @@ DoAssign(void) ** are built. This process continues until ** enough arrays are built to handle the tolerance. */ - while (1) { + do { + ++num_arrays; + array = realloc(array, sizeof(long) * ASSIGNROWS * ASSIGNCOLS * num_arrays); if (!array) { fprintf(stderr, "Error in %s, could not allocate memory. Exitting...\n", context); @@ -98,12 +100,7 @@ DoAssign(void) ** minimum, then allocate for more arrays and ** try again. */ - if (DoAssignIteration(array, num_arrays) > MINIMUM_TICKS) { - break; - } - - ++num_arrays; - } + } while (DoAssignIteration(array, num_arrays) <= MINIMUM_TICKS); } else { array = malloc(sizeof(long) * ASSIGNROWS * ASSIGNCOLS * num_arrays); if (!array) { -- cgit v1.2.3