From e6698bc32ce45dda55823825d837291b5850ac8b Mon Sep 17 00:00:00 2001 From: Yunchih Chen Date: Tue, 20 Mar 2018 10:25:27 +0800 Subject: Add comments && formatting --- lib/collect.c | 6 +++--- lib/common.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/collect.c b/lib/collect.c index 0fdbe52..5ca8139 100644 --- a/lib/collect.c +++ b/lib/collect.c @@ -120,8 +120,7 @@ static void nfl_init(nfl_state_t *nf) { /* ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, sizeof(struct * iphdr) + 4) < 0, */ - ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, nfl_recv_size) < - 0, + ERR(nflog_set_mode(nf->nfl_group_fd, NFULNL_COPY_PACKET, nfl_recv_size) < 0, "Could not set copy mode"); nflog_callback_register(nf->nfl_group_fd, &handle_packet, nf); @@ -222,7 +221,8 @@ void nfl_state_init(nfl_state_t **nf, uint32_t id, uint32_t entries_max, } // Ensure trunk with same id in previous run has finished to prevent reusing - // a trunk which it's still being used. Furthermore, this hopefully alleviate us + // a trunk which it's still being used. Furthermore, this hopefully + // alleviate us // from bursty network traffic. pthread_mutex_lock(&(*nf)->has_finished_lock); while (!(*nf)->has_finished) diff --git a/lib/common.c b/lib/common.c index 3cbf19b..e1f7e91 100644 --- a/lib/common.c +++ b/lib/common.c @@ -35,7 +35,7 @@ int nfl_storage_match_index(const char *fn) { regmatch_t match[1]; int ret; - if(unlikely(!strcmp(fn, ".") || !strcmp(fn, ".."))) + if (unlikely(!strcmp(fn, ".") || !strcmp(fn, ".."))) return -1; if (!compiled) { @@ -72,7 +72,7 @@ uint32_t nfl_get_filesize(FILE *f) { } uint32_t nfl_header_cksum(nfl_header_t *header) { - #define H(s) (0x9e3779b9 + (s<< 6) + (s>> 1)) +#define H(s) (0x9e3779b9 + (s << 6) + (s >> 1)) register uint64_t s = 3784672181; s ^= H(header->id); s ^= H(header->max_n_entries); -- cgit v1.2.3