From 080df0a9387a9fd22f2a795a6335d2b45f9a6af1 Mon Sep 17 00:00:00 2001 From: michael Date: Sun, 15 Mar 2015 13:04:24 +0000 Subject: [PATCH] - Style corrections git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5695 82007160-df01-0410-b94d-b575c5fd34c7 --- src/dnsbl.c | 16 ++++++++-------- src/firedns.c | 4 ++-- src/irc.c | 20 +++++++++----------- src/negcache.c | 2 +- src/opercmd.c | 12 ++++++------ src/scan.c | 20 ++++++++++---------- 6 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/dnsbl.c b/src/dnsbl.c index 9cf966f..f8ea9a4 100644 --- a/src/dnsbl.c +++ b/src/dnsbl.c @@ -53,7 +53,7 @@ dnsbl_add(struct scan_struct *ss) struct in_addr in; unsigned char a, b, c, d; char lookup[128]; - node_t *p; + node_t *node; int res; struct dnsbl_scan *ds; @@ -68,9 +68,9 @@ dnsbl_add(struct scan_struct *ss) b = (unsigned char)(in.s_addr >> 8) & 0xFF; a = (unsigned char) in.s_addr & 0xFF; - LIST_FOREACH(p, OpmItem->blacklists->head) + LIST_FOREACH(node, OpmItem->blacklists->head) { - struct BlacklistConf *bl = p->data; + struct BlacklistConf *bl = node->data; #ifdef WORDS_BIGENDIAN snprintf(lookup, sizeof(lookup), "%d.%d.%d.%d.%s", a, b, c, d, bl->name); @@ -101,13 +101,13 @@ static void dnsbl_positive(struct scan_struct *ss, struct BlacklistConf *bl, unsigned char type) { char text_type[128] = ""; - node_t *p; + node_t *node; if (bl->type == A_BITMASK) { - LIST_FOREACH(p, bl->reply->head) + LIST_FOREACH(node, bl->reply->head) { - const struct BlacklistReplyConf *item = p->data; + const struct BlacklistReplyConf *item = node->data; if (item->number & type) { @@ -124,9 +124,9 @@ dnsbl_positive(struct scan_struct *ss, struct BlacklistConf *bl, unsigned char t } else { - LIST_FOREACH(p, bl->reply->head) + LIST_FOREACH(node, bl->reply->head) { - const struct BlacklistReplyConf *item = p->data; + const struct BlacklistReplyConf *item = node->data; if (item->number == type) { diff --git a/src/firedns.c b/src/firedns.c index fdb48b7..bd6c5d8 100644 --- a/src/firedns.c +++ b/src/firedns.c @@ -762,7 +762,7 @@ cleanup: void firedns_cycle(void) { - node_t *node, *next; + node_t *node, *node_next; struct s_connection *p; struct firedns_result *res, new_result; static struct pollfd *ufds = NULL; @@ -779,7 +779,7 @@ firedns_cycle(void) time(&timenow); size = 0; - LIST_FOREACH_SAFE(node, next, CONNECTIONS->head) + LIST_FOREACH_SAFE(node, node_next, CONNECTIONS->head) { if (size >= OptionsItem->dns_fdlimit) break; diff --git a/src/irc.c b/src/irc.c index ee0e185..f5d0c6d 100644 --- a/src/irc.c +++ b/src/irc.c @@ -78,15 +78,13 @@ static void m_kill(char *[], unsigned int, const char *, const struct UserInfo * * Certain variables we don't want to allocate memory for over and over * again so global scope is given. */ +static char IRC_RAW[MSGLENMAX]; /* Buffer to read data into */ +static unsigned int IRC_RAW_LEN; /* Position of IRC_RAW */ +static int IRC_FD; /* File descriptor for IRC client */ -static char IRC_RAW[MSGLENMAX]; /* Buffer to read data into */ -static unsigned int IRC_RAW_LEN = 0; /* Position of IRC_RAW */ -static int IRC_FD = 0; /* File descriptor for IRC client */ - -static struct sockaddr_storage IRC_SVR; /* Sock Address Struct for IRC server */ - -static time_t IRC_LAST = 0; /* Last full line of data from irc server*/ -static time_t IRC_LASTRECONNECT = 0; /* Time of last reconnection */ +static struct sockaddr_storage IRC_SVR; /* Sock Address Struct for IRC server */ +static time_t IRC_LAST; /* Last full line of data from irc server */ +static time_t IRC_LASTRECONNECT; /* Time of last reconnection */ /* * Table should be ordered with most occuring (or priority) @@ -126,7 +124,7 @@ irc_cycle(void) if (IRC_FD <= 0) { /* Initialise negative cache. */ - if (OptionsItem->negcache > 0) + if (OptionsItem->negcache) nc_init(&nc_head); /* Resolve remote host. */ @@ -594,12 +592,12 @@ userinfo_create(const char *source) char *username = NULL; char *hostname = NULL; char tmp[MSGLENMAX]; - size_t i, len; + size_t len; len = strlcpy(tmp, source, sizeof(tmp)); nick = tmp; - for (i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { if (tmp[i] == '!') { diff --git a/src/negcache.c b/src/negcache.c index a0b2031..a4caab2 100644 --- a/src/negcache.c +++ b/src/negcache.c @@ -174,7 +174,7 @@ struct cnode *check_neg_cache(const unsigned long ip) time_t now; struct cnode *n; - if (OptionsItem->negcache <= 0) + if (OptionsItem->negcache == 0) return(NULL); n = nc_search(nc_head, ip); diff --git a/src/opercmd.c b/src/opercmd.c index 103be05..07873df 100644 --- a/src/opercmd.c +++ b/src/opercmd.c @@ -87,7 +87,7 @@ void command_timer(void) { static unsigned int interval; - node_t *node, *next; + node_t *node, *node_next; time_t present; /* Only perform command removal every COMMANDINTERVAL seconds */ @@ -98,7 +98,7 @@ command_timer(void) time(&present); - LIST_FOREACH_SAFE(node, next, COMMANDS->head) + LIST_FOREACH_SAFE(node, node_next, COMMANDS->head) { struct Command *cs = node->data; @@ -108,7 +108,7 @@ command_timer(void) list_remove(COMMANDS, node); node_free(node); } - else /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */ + else /* Since the queue is in order, it's also ordered by time, no nodes after this will be timed out */ return; } } @@ -214,7 +214,7 @@ command_create(const struct OperCommandHash *tab, char *param, char *irc_nick, ret->irc_nick = xstrdup(irc_nick); ret->target = target; /* FIXME: This needs fixed if rehash is implemented */ - time(&(ret->added)); + time(&ret->added); return ret; } @@ -253,7 +253,7 @@ command_free(struct Command *command) void command_userhost(const char *reply) { - node_t *node, *next; + node_t *node, *node_next; char *tmp; int oper = 0; @@ -274,7 +274,7 @@ command_userhost(const char *reply) *(tmp) = '\0'; /* Find any queued commands that match this user */ - LIST_FOREACH_SAFE(node, next, COMMANDS->head) + LIST_FOREACH_SAFE(node, node_next, COMMANDS->head) { struct Command *cs = node->data; diff --git a/src/scan.c b/src/scan.c index 5ea6c44..8ea6e7e 100644 --- a/src/scan.c +++ b/src/scan.c @@ -85,15 +85,15 @@ extern FILE *scanlogfile; void scan_cycle(void) { - node_t *p; + node_t *node; /* Cycle through the blacklist first.. */ dnsbl_cycle(); /* Cycle each scanner object */ - LIST_FOREACH(p, SCANNERS->head) + LIST_FOREACH(node, SCANNERS->head) { - struct scanner_struct *scs = p->data; + struct scanner_struct *scs = node->data; opm_cycle(scs->scanner); } } @@ -111,7 +111,7 @@ scan_timer(void) { static time_t nc_counter; - if (OptionsItem->negcache > 0) + if (OptionsItem->negcache) { if (nc_counter++ >= OptionsItem->negcache_rebuild) { @@ -271,7 +271,7 @@ scan_init(void) } /* Initialise negative cache */ - if (OptionsItem->negcache > 0) + if (OptionsItem->negcache) { if (OPT_DEBUG >= 2) log_printf("SCAN -> Initializing negative cache"); @@ -314,7 +314,7 @@ scan_connect(const char *user[], const char *msg) char ipmask[MSGLENMAX]; /* Check negcache before anything */ - if (OptionsItem->negcache > 0) + if (OptionsItem->negcache) { if (inet_pton(AF_INET, user[3], &ip.sin_addr) <= 0) { @@ -748,7 +748,7 @@ static void scan_negative(const struct scan_struct *ss) { /* Insert IP in negcache */ - if (OptionsItem->negcache > 0) + if (OptionsItem->negcache) { if (OPT_DEBUG >= 2) log_printf("SCAN -> Adding %s to negative cache", ss->ip); @@ -865,7 +865,7 @@ scan_manual(char *param, const struct ChannelConf *target) struct scanner_struct *scs; const char *ip = NULL; char *scannername; - node_t *p; + node_t *node; int ret; /* If there were no parameters sent, simply alert the user and return */ @@ -920,9 +920,9 @@ scan_manual(char *param, const struct ChannelConf *target) dnsbl_add(ss); /* Add ss->remote to all scanners */ - LIST_FOREACH(p, SCANNERS->head) + LIST_FOREACH(node, SCANNERS->head) { - scs = p->data; + scs = node->data; /* * If we have a scannername, only allow that scanner -- 2.30.2