]> jfr.im git - irc/ircd-hybrid/hopm.git/commitdiff
- Stylistic changes
authormichael <redacted>
Sun, 29 Mar 2020 13:16:11 +0000 (13:16 +0000)
committermichael <redacted>
Sun, 29 Mar 2020 13:16:11 +0000 (13:16 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/branches/1.1.x@9329 82007160-df01-0410-b94d-b575c5fd34c7

src/config.c
src/dnsbl.c
src/irc.c

index db4ef92bf4aaf7f90880662431effbd862fd9ea0..99e7d67997810416d8467a387b8fb68c7b178bfa 100644 (file)
@@ -68,7 +68,7 @@ config_setup(void)
   OptionsItem.command_queue_size = 64;
   OptionsItem.command_interval = 10;
   OptionsItem.command_timeout = 180;
-  OptionsItem.negcache = 0;   /* 0 disabled negcache */
+  OptionsItem.negcache = 0;  /* 0 disabled negcache */
   OptionsItem.negcache_rebuild = 43200;
   OptionsItem.pidfile = xstrdup("hopm.pid");
   OptionsItem.dns_fdlimit = 50;
@@ -85,7 +85,8 @@ config_load(const char *filename)
 
   strlcpy(conffilebuf, filename, sizeof(conffilebuf));
 
-  if ((conf_file = fopen(filename, "r")) == NULL)
+  conf_file = fopen(filename, "r");
+  if (conf_file == NULL)
   {
     log_printf("CONFIG -> Error opening %s: %s", filename, strerror(errno));
     exit(EXIT_FAILURE);
index 9b74258e0ced43a1066fe6ba9299816073e9c6bd..9082d7a404b06e8e807dbcaa9535ae34d0b05ff5 100644 (file)
@@ -260,7 +260,6 @@ void
 dnsbl_report(const struct scan_struct *ss)
 {
   char buf[2048], cmdbuf[256];
-  FILE *fp;
 
   assert(ss->ip);
 
@@ -281,7 +280,8 @@ dnsbl_report(const struct scan_struct *ss)
   if (OPT_DEBUG >= 3)
     log_printf("DNSBL -> Sending following email:\n%s\n", buf);
 
-  if ((fp = popen(cmdbuf, "w")) == NULL)
+  FILE *fp = popen(cmdbuf, "w");
+  if (fp == NULL)
   {
     log_printf("DNSBL -> Failed to create pipe to '%s' for email report!", cmdbuf);
     irc_send_channels("I was trying to create a pipe to '%s' to send a DNSBL "
index 6423e1611bed32a3200fb55a0a32b06159ced383..77f48b4e63aa2e834f808f6e3e398bc175472afa 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -178,14 +178,13 @@ m_ping(char *parv[], unsigned int parc, const char *msg, const char *source_p)
 static void
 m_invite(char *parv[], unsigned int parc, const char *msg, const char *source_p)
 {
-  const struct ChannelConf *channel = NULL;
-
   if (parc < 4)
     return;
 
   log_printf("IRC -> Invited to %s by %s", parv[3], parv[0]);
 
-  if ((channel = get_channel(parv[3])) == NULL)
+  const struct ChannelConf *channel = get_channel(parv[3]);
+  if (channel == NULL)
     return;
 
   irc_send("JOIN %s %s", channel->name, channel->key);
@@ -221,8 +220,6 @@ m_ctcp(char *parv[], unsigned int parc, const char *msg, const char *source_p)
 static void
 m_privmsg(char *parv[], unsigned int parc, const char *msg, const char *source_p)
 {
-  const struct ChannelConf *channel = NULL;
-
   if (source_p == NULL)
     return;
 
@@ -241,7 +238,8 @@ m_privmsg(char *parv[], unsigned int parc, const char *msg, const char *source_p
     return;
 
   /* Get a target */
-  if ((channel = get_channel(parv[2])) == NULL)
+  const struct ChannelConf *channel = get_channel(parv[2]);
+  if (channel == NULL)
     return;
 
   int hit = strncasecmp(parv[3], "!all ", 5) == 0;
@@ -377,13 +375,12 @@ m_userhost(char *parv[], unsigned int parc, const char *msg, const char *source_
 static void
 m_cannot_join(char *parv[], unsigned int parc, const char *msg, const char *source_p)
 {
-  const struct ChannelConf *channel = NULL;
-
   if (parc < 5)
     return;
 
   /* Is it one of our channels? */
-  if ((channel = get_channel(parv[3])) == NULL)
+  const struct ChannelConf *channel = get_channel(parv[3]);
+  if (channel == NULL)
     return;
 
   if (EmptyString(channel->invite))
@@ -461,7 +458,7 @@ userinfo_create(const char *source)
 static void
 irc_init(void)
 {
-  const void *address = NULL;
+  const void *address;
 
   assert(IRC_FD == -1);
 
@@ -506,7 +503,6 @@ irc_init(void)
   if (!EmptyString(IRCItem.vhost))
   {
     struct addrinfo hints, *res;
-    int n;
 
     memset(&hints, 0, sizeof(hints));
 
@@ -514,7 +510,8 @@ irc_init(void)
     hints.ai_socktype = SOCK_STREAM;
     hints.ai_flags = AI_NUMERICHOST;
 
-    if ((n = getaddrinfo(IRCItem.vhost, NULL, &hints, &res)))
+    int n = getaddrinfo(IRCItem.vhost, NULL, &hints, &res);
+    if (n)
     {
       log_printf("IRC -> error binding to %s: %s", IRCItem.vhost, gai_strerror(n));
       exit(EXIT_FAILURE);
@@ -824,10 +821,9 @@ irc_send(const char *data, ...)
 {
   va_list arglist;
   char buf[MSGLENMAX];
-  size_t len = 0;
 
   va_start(arglist, data);
-  len = vsnprintf(buf, sizeof(buf), data, arglist);
+  size_t len = vsnprintf(buf, sizeof(buf), data, arglist);
   va_end(arglist);
 
   if (OPT_DEBUG >= 2)