From 77d6c16eaf1f6df909f0362812e396c5a650a7da Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 29 Oct 2010 11:43:31 -0400 Subject: [PATCH] Run `indent -linux` to clean up whitespace in src/sorting/main.c. --- src/sorting/main.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/sorting/main.c b/src/sorting/main.c index 2fc6fb4..0bd6fd6 100644 --- a/src/sorting/main.c +++ b/src/sorting/main.c @@ -8,17 +8,15 @@ #include "sort.h" - #define NUM_SHOWN 3 //#define DEBUG - void printlist(FILE * stream, int list_size, double *list, int num_shown) { int i; if (num_shown > 0) { - if (num_shown > list_size/2) - num_shown = list_size/2; + if (num_shown > list_size / 2) + num_shown = list_size / 2; for (i = 0; i < num_shown; i++) fprintf(stream, "%g\t", list[i]); fprintf(stream, "...\n...\t"); @@ -68,7 +66,7 @@ int read_data(const char *file_name, int *pList_size, double **pList) // read in the data #ifdef DEBUG fprintf(stderr, "reading %d points\n", *pList_size); -#endif /* DEBUG */ +#endif /* DEBUG */ for (i = 0; i < *pList_size; i++) { fscanf(fp, "%lf", &x); (*pList)[i] = x; @@ -87,7 +85,7 @@ int main(int argc, char *argv[]) char *file_name = "-"; #ifdef DEBUG int i; -#endif /* DEBUG */ +#endif /* DEBUG */ // parse arguments if (argc > 1) @@ -103,7 +101,7 @@ int main(int argc, char *argv[]) printlist(stderr, list_size, list, NUM_SHOWN); fprintf(stderr, "Check: sum of %d elements = %g\n", list_size, checklist(list_size, list)); -#endif /* DEBUG */ +#endif /* DEBUG */ /* sort the list */ sort(list_size, list); @@ -114,14 +112,15 @@ int main(int argc, char *argv[]) printlist(stderr, list_size, list, NUM_SHOWN); fprintf(stderr, "Check: sum of %d elements = %g\n", list_size, checklist(list_size, list)); - for (i=0; i < list_size-1; i++) { - if (list[i] > list[i+1]) { - fprintf(stderr, "Error: sorted list[%d] = %g > %g = list[%d]\n", - i, list[i], list[i+1], i+1); - exit(EXIT_FAILURE); - } + for (i = 0; i < list_size - 1; i++) { + if (list[i] > list[i + 1]) { + fprintf(stderr, + "Error: sorted list[%d] = %g > %g = list[%d]\n", + i, list[i], list[i + 1], i + 1); + exit(EXIT_FAILURE); + } } -#endif /* DEBUG */ +#endif /* DEBUG */ printlist(stdout, list_size, list, 0); -- 2.26.2