- Removed pointless casts
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 23 Dec 2014 19:59:18 +0000 (19:59 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Tue, 23 Dec 2014 19:59:18 +0000 (19:59 +0000)
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@5091 82007160-df01-0410-b94d-b575c5fd34c7

src/firedns.c
src/irc.c
src/libopm/src/libopm.c
src/opercmd.c
src/opercmd.h
src/scan.c

index 02874961719017f633ccbb3860da73307a6af13b..2d3c0b80bb864674de5718a3778f0552b9427098 100644 (file)
@@ -582,7 +582,7 @@ struct firedns_result *firedns_getresult(const int fd)
    /* Find query in list of dns lookups */
    LIST_FOREACH(node, CONNECTIONS->head)
    {
-      c = (struct s_connection *) node->data;
+      c = node->data;
       if(c->fd == fd)
          break;
       else
@@ -743,7 +743,7 @@ void firedns_cycle(void)
       if(size >= OptionsItem->dns_fdlimit)
          break;
 
-      p = (struct s_connection *) node->data;
+      p = node->data;
 
       if(p->fd < 0)
          continue;
@@ -788,7 +788,7 @@ void firedns_cycle(void)
 
    LIST_FOREACH_SAFE(node, next, CONNECTIONS->head)
    {
-      p = (struct s_connection *) node->data;
+      p = node->data;
       if(p->fd > 0)
       {
          for(i = 0; i < size; i++)
index f6a4cc055905568fc10baa89179db7efe1530ba8..b56def06c53593344cfda3b15162a325803be022 100644 (file)
--- a/src/irc.c
+++ b/src/irc.c
@@ -307,7 +307,7 @@ static void irc_init(void)
    IRC_CHANNELS[0] = '\0';
    LIST_FOREACH(node, IRCItem->channels->head)
    {
-      chan = (struct ChannelConf *) node->data;
+      chan = node->data;
       strlcat(IRC_CHANNELS, chan->name, sizeof(IRC_CHANNELS));
 
       if(node->next)
@@ -813,12 +813,12 @@ static void m_perform(char **parv, unsigned int parc, char *msg, struct UserInfo
 
    /* Perform */
    LIST_FOREACH(node, IRCItem->performs->head)
-      irc_send("%s", (char *) node->data);
+      irc_send("%s", node->data);
 
    /* Join all listed channels. */
    LIST_FOREACH(node, IRCItem->channels->head)
    {
-      channel = (struct ChannelConf *) node->data;
+      channel = node->data;
 
       if (EmptyString(channel->name))
          continue;
index 06109a84f4ebfe11edcfcc692a17a25d1135461a..226a7c9d921d64464df8816a684e77f71ee3a57a 100644 (file)
@@ -205,7 +205,7 @@ void opm_remote_free(OPM_REMOTE_T *remote)
 
    LIST_FOREACH_SAFE(p, next, remote->protocols->head)
    {
-      ppc = (OPM_PROTOCOL_CONFIG_T *) p->data;
+      ppc = p->data;
 
       libopm_protocol_config_free(ppc);
       libopm_list_remove(remote->protocols, p);
@@ -265,7 +265,7 @@ void opm_free(OPM_T *scanner)
 
    LIST_FOREACH_SAFE(p, next, scanner->protocols->head)
    {
-      ppc = (OPM_PROTOCOL_CONFIG_T *) p->data;
+      ppc = p->data;
 
       libopm_protocol_config_free(ppc);
       libopm_list_remove(scanner->protocols, p);
@@ -274,7 +274,7 @@ void opm_free(OPM_T *scanner)
 
    LIST_FOREACH_SAFE(p, next, scanner->scans->head)
    {
-      scan = (OPM_SCAN_T *) p->data;
+      scan = p->data;
       libopm_scan_free(scan);
       libopm_list_remove(scanner->scans, p);
       libopm_node_free(p);
@@ -282,7 +282,7 @@ void opm_free(OPM_T *scanner)
 
    LIST_FOREACH_SAFE(p, next, scanner->queue->head)
    {
-      scan = (OPM_SCAN_T *) p->data;
+      scan = p->data;
       libopm_scan_free(scan);
       libopm_list_remove(scanner->queue, p);
       libopm_node_free(p);
@@ -572,14 +572,14 @@ void opm_end(OPM_T *scanner, OPM_REMOTE_T *remote)
 
    LIST_FOREACH_SAFE(node1, next1, scanner->queue->head)
    {
-      scan = (OPM_SCAN_T *) node1->data;
+      scan = node1->data;
       if(scan->remote == remote)
       {
          /* Free all connections */
          LIST_FOREACH_SAFE(node2, next2, scan->connections->head)
          {
 
-            conn = (OPM_CONNECTION_T *) node2->data;
+            conn = node2->data;
 
             libopm_list_remove(scan->connections, node2);
             libopm_connection_free(conn);
@@ -629,7 +629,7 @@ void opm_endscan(OPM_T *scanner, OPM_REMOTE_T *remote)
    */
    LIST_FOREACH(node1, scanner->scans->head)
    {
-      scan = (OPM_SCAN_T *) node1->data;
+      scan = node1->data;
 
       if(scan->remote == remote)
       {
@@ -742,7 +742,7 @@ static void libopm_scan_free(OPM_SCAN_T *scan)
 
    LIST_FOREACH_SAFE(p, next, scan->connections->head)
    {
-      conn = (OPM_CONNECTION_T *) p->data;
+      conn = p->data;
       libopm_connection_free(conn);
 
       libopm_list_remove(scan->connections, p);
@@ -856,7 +856,7 @@ static void libopm_check_queue(OPM_T *scanner)
    {
 
       /* Grab the top scan */
-      scan = (OPM_SCAN_T *) scanner->queue->head->data;      
+      scan = scanner->queue->head->data;      
       protocols = LIST_SIZE(scan->connections);
 
       /* Check if it will fit in the live scan list */
@@ -904,14 +904,14 @@ static void libopm_check_establish(OPM_T *scanner)
 
    LIST_FOREACH(node1, scanner->scans->head)
    {
-      scan = (OPM_SCAN_T *) node1->data;
+      scan = node1->data;
       LIST_FOREACH(node2, scan->connections->head)
       {
          /* Only scan if we have free file descriptors */
          if(scanner->fd_use >= fd_limit)
             return;
 
-         conn = (OPM_CONNECTION_T *) node2->data;
+         conn = node2->data;
          if(conn->state == OPM_STATE_UNESTABLISHED)
             libopm_do_connect(scanner, scan, conn);
       } 
@@ -956,11 +956,11 @@ static void libopm_check_closed(OPM_T *scanner)
 
    LIST_FOREACH_SAFE(node1, next1, scanner->scans->head)
    {
-      scan = (OPM_SCAN_T *) node1->data;
+      scan = node1->data;
       LIST_FOREACH_SAFE(node2, next2, scan->connections->head)
       {
 
-         conn = (OPM_CONNECTION_T *) node2->data;
+         conn = node2->data;
 
          if(conn->state == OPM_STATE_CLOSED)
          {
@@ -1105,13 +1105,13 @@ static void libopm_check_poll(OPM_T *scanner)
 
    LIST_FOREACH(node1, scanner->scans->head)
    {
-      scan = (OPM_SCAN_T *) node1->data;
+      scan = node1->data;
       LIST_FOREACH(node2, scan->connections->head)
       {
          if(size >= ufds_size)
             break;
 
-         conn = (OPM_CONNECTION_T *) node2->data;
+         conn = node2->data;
        
          if(conn->state < OPM_STATE_ESTABLISHED ||
             conn->state == OPM_STATE_CLOSED)
@@ -1284,7 +1284,7 @@ static void libopm_do_read(OPM_T *scanner, OPM_SCAN_T *scan, OPM_CONNECTION_T *c
    list = (OPM_LIST_T *) libopm_config(scanner->config, OPM_CONFIG_TARGET_STRING);
    LIST_FOREACH(node, list->head)
    {
-      target_string = (char *) node->data;
+      target_string = node->data;
       if(strstr(conn->readbuf, target_string))
       {
          libopm_do_openproxy(scanner, scan, conn);
index 4f6cdc1755f9e4efe012ca6124fb02d4bdb3867e..c9f57755a458e1817c2e0c93480a3008f667ff2e 100644 (file)
@@ -114,7 +114,7 @@ void command_timer()
 
    LIST_FOREACH_SAFE(node, next, COMMANDS->head)
    {
-      cs = (struct Command *) node->data;
+      cs = node->data;
       if((present - cs->added) > COMMANDTIMEOUT)
       {
          command_free(cs);
@@ -307,7 +307,7 @@ void command_userhost(char *reply)
    /* Find any queued commands that match this user */
    LIST_FOREACH_SAFE(node, next, COMMANDS->head)
    {
-      cs = (struct Command *) node->data;
+      cs = node->data;
 
       if(strcmp(cs->irc_nick, reply) == 0)
       {
index 295f5d7eba50a826bdc793ed15e9112b9d063c78..af6376abeb185bb942f25b9d9854fb7d7ebcf19b 100644 (file)
@@ -29,13 +29,10 @@ struct Command
    time_t added;
 };
 
-
-typedef void (*oper_command) (char *, char*, struct ChannelConf *);
-
 struct OperCommandHash
 {
    const char *command;
-   oper_command handler;
+   void (*handler)(char *, char*, struct ChannelConf *);
 };
 
 extern void command_init(void);
index eae8c88ab23615d064afcae79321029c3dcd7086..2abed0038a22d47495e257fc23cb08bb7f667e27 100644 (file)
@@ -118,7 +118,7 @@ void scan_cycle()
    /* Cycle each scanner object */
    LIST_FOREACH(p, SCANNERS->head)
    {
-      scs = (struct scanner_struct *) p->data;
+      scs = p->data;
       opm_cycle(scs->scanner);
    }
 }
@@ -257,7 +257,7 @@ void scan_init()
       /* Setup the protocols */
       LIST_FOREACH(p2, sc->protocols->head)
       {
-         pc = (struct ProtocolConf *) p2->data;
+         pc = p2->data;
 
          if(OPT_DEBUG >= 2)
          {
@@ -280,20 +280,20 @@ void scan_init()
    /* Give scanners a list of masks they scan */
    LIST_FOREACH(p, SCANNERS->head)
    {
-      scs = (struct scanner_struct *) p->data;
+      scs = p->data;
 
       LIST_FOREACH(p2, UserItemList->head)
       {
-         uc = (struct UserConf *) p2->data;
+         uc = p2->data;
          LIST_FOREACH(p3, uc->scanners->head)
          {
-            scannername = (char *) p3->data;
+            scannername = p3->data;
             /* Add all these masks to scanner */
             if(strcasecmp(scannername, scs->name) == 0)
             {
                LIST_FOREACH(p4, uc->masks->head)
                {
-                  mask = (char *) p4->data;
+                  mask = p4->data;
 
                   if(OPT_DEBUG)
                   {
@@ -403,10 +403,10 @@ void scan_connect(char **user, char *msg)
    /* Add ss->remote to all matching scanners */
    LIST_FOREACH(p, SCANNERS->head)
    {
-      scs = (struct scanner_struct *) p->data;
+      scs = p->data;
       LIST_FOREACH(p2, scs->masks->head)
       {
-         scsmask = (char *) p2->data;
+         scsmask = p2->data;
          if(!match(scsmask, mask))
          {
             if(OPT_DEBUG)
@@ -588,7 +588,7 @@ void scan_positive(struct scan_struct *ss, const char *kline, const char *type)
    /* Close all scans prematurely */
    LIST_FOREACH(node, SCANNERS->head)
    {
-      scanner = (OPM_T *) ((struct scanner_struct *) node->data)->scanner;
+      scanner = ((struct scanner_struct *)node->data)->scanner;
       opm_end(scanner, ss->remote);
    }
 
@@ -619,8 +619,8 @@ void scan_open_proxy(OPM_T *scanner, OPM_REMOTE_T *remote, int notused,
    /* Record that a scan happened */
    scan_log(remote);
 
-   scs = (struct scanner_struct *) data;
-   ss = (struct scan_struct *) remote->data;
+   scs = data;
+   ss = remote->data;
 
    if(ss->manual_target == NULL)
    {
@@ -677,8 +677,8 @@ void scan_negotiation_failed(OPM_T *scanner, OPM_REMOTE_T *remote,
    /* Record that a scan happened */
    scan_log(remote);
 
-   scs = (struct scanner_struct *) data;
-//   ss = (struct scan_struct *) remote->data;
+   scs = data;
+//   ss = remote->data;
 
    if(OPT_DEBUG)
    {
@@ -720,8 +720,8 @@ static void scan_timeout(OPM_T *scanner, OPM_REMOTE_T *remote, int notused,
    /* Record that a scan happened */
    scan_log(remote);
 
-   scs = (struct scanner_struct *) data;
-//   ss = (struct scan_struct *) remote->data;
+   scs = data;
+//   ss = remote->data;
 
    if(OPT_DEBUG)
    {
@@ -762,8 +762,8 @@ static void scan_end(OPM_T *scanner, OPM_REMOTE_T *remote, int notused,
    struct scan_struct *ss;
    struct scanner_struct *scs;
 
-   scs = (struct scanner_struct *) data;
-   ss = (struct scan_struct *) remote->data;
+   scs = data;
+   ss = remote->data;
 
    if(OPT_DEBUG)
       log_printf("SCAN -> Scan %s [%s] completed", remote->ip, scs->name);
@@ -796,8 +796,8 @@ static void scan_handle_error(OPM_T *scanner, OPM_REMOTE_T *remote,
    struct scan_struct *ss;
    struct scanner_struct *scs;
 
-   scs = (struct scanner_struct *) data;
-   ss = (struct scan_struct *) remote->data;
+   scs = data;
+   ss = remote->data;
 
    switch(err)
    {
@@ -1055,7 +1055,7 @@ void scan_manual(char *param, struct ChannelConf *target)
    /* Add ss->remote to all scanners */
    LIST_FOREACH(p, SCANNERS->head)
    {
-      scs = (struct scanner_struct *) p->data;
+      scs = p->data;
 
       /* If we have a scannername, only allow that scanner
          to be used */
@@ -1150,7 +1150,7 @@ static void scan_log(OPM_REMOTE_T *remote)
    char buf_present[25];
    time_t present;
    struct tm *tm_present;
-   struct scan_struct *ss = (struct scan_struct *) remote->data;
+   struct scan_struct *ss = remote->data;
 
    if(!(OptionsItem->scanlog && scanlogfile))
       return;