summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2008-11-17 00:46:33 +0000
committerMatt Turner <mattst88@gmail.com>2008-11-17 00:46:33 +0000
commit625ae827c8d413473ee957e7f07b9f67120a9678 (patch)
tree2204b8b9a3ff621bb61cbb1cb861621bc5e7eb12
parentf4b5f6283c65c88d2d6d5560f2c5ec40eab9bf17 (diff)
Convert while(1) loop to do while
git-svn-id: svn://mattst88.com/svn/cleanbench/trunk@71 0d43b9a7-5ab2-4d7b-af9d-f64450cef757
-rw-r--r--assignment.c13
1 files 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) {