From 39ad0db84adecfeb8ec2e2c7628b9d55a3fe0894 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Thu, 7 Mar 2019 16:29:02 +0100 Subject: Build all postprocess tools with make --- src/postprocess/merge_entries.c | 20 ++++++++++++-------- src/postprocess/sort_plz.c | 2 ++ 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src/postprocess') diff --git a/src/postprocess/merge_entries.c b/src/postprocess/merge_entries.c index f89113e..f9ee67d 100644 --- a/src/postprocess/merge_entries.c +++ b/src/postprocess/merge_entries.c @@ -193,12 +193,15 @@ static void escape_string(char * s, size_t len) { } int main(int argc, char **args) { - MAP tbuch = map_file(args[1], 1); + MAP tbuch; char *ptr; entry_t * sort_array; - int current = -1, outoff = 0, lines = COLUMNS, i; + int outoff = 0, lines = COLUMNS; + unsigned long current = 0, i, flag; uint64_t year_list = 0, revflag_list = 0, bizflag_list = 0; - long flag = 0; + + if (argc != 1) exit(1); + tbuch = map_file(args[1], 1); /* Estimate upper bound for amount of lines */ for (i=0; isize; ++i) @@ -232,13 +235,14 @@ int main(int argc, char **args) { } if (flag&2) { - assert( current >= 0); - sort_array[current].rows++; + assert(current>0); + sort_array[current-1].rows++; } else { - sort_array[++current].rows = 0; + sort_array[current].rows = 0; sort_array[current].outoff = outoff; sort_array[current].flag = flag; sort_array[current].year = year; + current++; } outoff += COLUMNS; } @@ -246,12 +250,12 @@ int main(int argc, char **args) { /* Sort the whole thing */ qsort(sort_array, current, sizeof(entry_t), sort_me); - for (i=0; i<=current; ++i) { + for (i=0; i