diff options
Diffstat (limited to 'stringsort.c')
-rw-r--r-- | stringsort.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/stringsort.c b/stringsort.c index d19d14f..a8ff4f3 100644 --- a/stringsort.c +++ b/stringsort.c @@ -1,6 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <stdint.h> +#include <stdbool.h> #include <string.h> #include <math.h> #include <limits.h> @@ -18,7 +19,7 @@ ** The following constant STRINGARRAYSIZE determines ** the default # of bytes allocated to each string array. */ -#define ARRAY_SIZE 8111L +#define ARRAY_SIZE 8111 static clock_t DoStringSortIteration(unsigned char *array, @@ -59,10 +60,10 @@ void DoStringSort(void) clock_t total_time = 0; int iterations = 0; static int num_arrays = 1; - static int is_adjusted = FALSE; + static bool is_adjusted = false; - if (is_adjusted == FALSE) { - is_adjusted = TRUE; + if (is_adjusted == false) { + is_adjusted = true; /* ** Initialize the number of arrays. */ @@ -422,7 +423,7 @@ for(i=top; i>0; --i) ** 2) A pointer to a string array ** 3) The number of elements in the string array ** 4) Offsets to two strings (a & b) -** This function returns TRUE if string a is < string b. +** This function returns true if string a is < string b. */ static int str_is_less(unsigned long *optrarray, /* Offset pointers */ unsigned char *strarray, /* String array */ @@ -446,18 +447,18 @@ slen=strncmp((char *)(strarray+*(optrarray+a)), if(slen==0) { /* - ** They match. Return TRUE if the length of a + ** They match. Return true if the length of a ** is greater than the length of b. */ if(*(strarray+*(optrarray+a)) > *(strarray+*(optrarray+b))) - return TRUE; - return FALSE; + return true; + return false; } -if(slen<0) return TRUE; /* a is strictly less than b */ +if(slen<0) return true; /* a is strictly less than b */ -return FALSE; /* Only other possibility */ +return false; /* Only other possibility */ } /************ |