commit e07e733cb695fdd3ebb328ca15619ac12ca02952
parent 0d416471976a7ea4a1666821023a91c357ca11f6
Author: Frederic Cambus <fcambus@users.sourceforge.net>
Date: Sun, 28 Jun 2015 16:38:23 +0200
Small cleanups
Diffstat:
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/logswan.c b/src/logswan.c
@@ -146,7 +146,7 @@ int main (int argc, char *argv[]) {
if (parsedLine.objectSize) {
bandwidth = strtonum(parsedLine.objectSize, 0, INT64_MAX, &errstr);
- if (!errstr) {
+ if (!errstr) {
results.bandwidth += bandwidth;
}
}
diff --git a/src/output.c b/src/output.c
@@ -24,20 +24,20 @@ char *output(Results results) {
json_t *httpStatusArray = json_array();
for (int loop=0; loop<255; loop++) {
- if (results.countries[loop] != 0) {
+ if (results.countries[loop]) {
json_array_append_new(countriesArray, json_pack("{s:s, s:i}", "data", GeoIP_code_by_id(loop), "hits", results.countries[loop]));
}
}
for (int loop=0; loop<24; loop++) {
- if (results.hours[loop] != 0) {
+ if (results.hours[loop]) {
json_array_append_new(hoursArray, json_pack("{s:i, s:i}", "data", loop, "hits", results.hours[loop]));
}
}
for (int loop=0; loop<512; loop++) {
- if (results.httpStatus[loop] != 0) {
- json_array_append_new(httpStatusArray, json_pack("{s:i, s:i}", "data", loop, "hits", results.httpStatus[loop]));
+ if (results.httpStatus[loop]) {
+ json_array_append_new(httpStatusArray, json_pack("{s:i, s:i}", "data", loop, "hits", results.httpStatus[loop]));
}
}
diff --git a/src/parse.c b/src/parse.c
@@ -17,7 +17,7 @@
void parseDate(struct date* parsedDate, char *date) {
parsedDate->day = strtok(date, "/");
- parsedDate->month = strtok(NULL, "/");
+ parsedDate->month = strtok(NULL, "/");
parsedDate->year = strtok(NULL, ":");
parsedDate->hour = strtok(NULL, ":");
parsedDate->minute = strtok(NULL, ":");