logswan

Fast Web log analyzer using probabilistic data structures
Log | Files | Refs | README | LICENSE

commit c72964b58909845b18ff9974629097af09c60927
parent 8f4ff605aaea08c805aae5757b57841c6d84b318
Author: Frederic Cambus <fred@statdns.com>
Date:   Sat, 17 Dec 2016 22:40:23 +0100

Move variables declaration out of main

Diffstat:
Msrc/logswan.c | 58+++++++++++++++++++++++++++++-----------------------------
1 file changed, 29 insertions(+), 29 deletions(-)

diff --git a/src/logswan.c b/src/logswan.c @@ -45,46 +45,46 @@ #include "output.h" #include "parse.h" -void displayUsage() { - printf("USAGE : logswan [options] inputfile\n\n" \ - "Options are :\n\n" \ - " -g Enable GeoIP lookups\n" \ - " -h Display usage\n" \ - " -v Display version\n\n"); -} +bool geoip = false; +GeoIP *geoipv4 = NULL, *geoipv6 = NULL; -int main (int argc, char *argv[]) { - bool geoip = false; - GeoIP *geoipv4 = NULL, *geoipv6 = NULL; +clock_t begin, end; - clock_t begin, end; +char lineBuffer[LINE_MAX_LENGTH]; - char lineBuffer[LINE_MAX_LENGTH]; +Results results; +struct date parsedDate; +struct logLine parsedLine; +struct request parsedRequest; - Results results; - struct date parsedDate; - struct logLine parsedLine; - struct request parsedRequest; +struct sockaddr_in ipv4; +struct sockaddr_in6 ipv6; +uint32_t isIPv4 = 0, isIPv6 = 0; - struct sockaddr_in ipv4; - struct sockaddr_in6 ipv6; - uint32_t isIPv4 = 0, isIPv6 = 0; +uint64_t bandwidth; +uint32_t statusCode; +uint32_t hour; +uint32_t countryId = 0; - uint64_t bandwidth; - uint32_t statusCode; - uint32_t hour; - uint32_t countryId = 0; +FILE *logFile; +struct stat logFileStat; - FILE *logFile; - struct stat logFileStat; +const char *errstr; - const char *errstr; +int8_t getoptFlag; - int8_t getoptFlag; +struct HLL uniqueIPv4, uniqueIPv6; +char *intputFile; - struct HLL uniqueIPv4, uniqueIPv6; - char *intputFile; +void displayUsage() { + printf("USAGE : logswan [options] inputfile\n\n" \ + "Options are :\n\n" \ + " -g Enable GeoIP lookups\n" \ + " -h Display usage\n" \ + " -v Display version\n\n"); +} +int main (int argc, char *argv[]) { if (pledge("stdio rpath", NULL) == -1) { err(EXIT_FAILURE, "pledge"); }