]> jfr.im git - irc/blitzed-org/bopm.git/commitdiff
Changed a load of (struct something *) MyMalloc casts to just MyMalloc to
authordgl <redacted>
Thu, 19 Jun 2003 16:12:31 +0000 (16:12 +0000)
committerdgl <redacted>
Thu, 19 Jun 2003 16:12:31 +0000 (16:12 +0000)
keep Andy happy, same with sizeof..
A few little warning fixes (with ./configure --extra-fascism), mostly for firedns.

src/config.c
src/config.h
src/dnsbl.c
src/firedns.c
src/firedns.h
src/main.c
src/scan.c

index d282f6189324f0ef9bb94fd0b19567137f437efd..81d3e42e2e983600a9873786f8b0729ebd77689a 100644 (file)
@@ -75,18 +75,18 @@ void config_load(const char *filename)
 void config_init()
 {
    /* Init IRC block */
-   IRCItem = (struct IRCConf *) MyMalloc(sizeof(struct IRCConf));
-   memset(IRCItem, 0, sizeof(struct IRCConf));
+   IRCItem = MyMalloc(sizeof *IRCItem);
+   memset(IRCItem, 0, sizeof *IRCItem);
    IRCItem->channels = list_create();
    IRCItem->performs = list_create();
 
    /* Init Options block */
-   OptionsItem = (struct OptionsConf *) MyMalloc(sizeof(struct OptionsConf));
-   memset(OptionsItem, 0, sizeof(struct OptionsConf));
+   OptionsItem = MyMalloc(sizeof *OptionsItem);
+   memset(OptionsItem, 0, sizeof *OptionsItem);
 
    /* Init OPM block */
-   OpmItem = (struct OpmConf *) MyMalloc(sizeof(struct OpmConf));
-   memset(OpmItem, 0, sizeof(struct OpmConf));
+   OpmItem = MyMalloc(sizeof *OpmItem);
+   memset(OpmItem, 0, sizeof *OpmItem);
    OpmItem->blacklists = list_create();
 
    /* Init list of User blocks */
@@ -96,7 +96,7 @@ void config_init()
    ScannerItemList = list_create();
 
    /* Init list of Exempts */
-   ExemptItem = (struct ExemptConf *) MyMalloc(sizeof(struct ExemptConf));
+   ExemptItem = MyMalloc(sizeof *ExemptItem);
    ExemptItem->masks = list_create();
 }
 
index 7b1e1b5e704f3a4689073b43881c260ce56c41d5..f6a427330a12cb04d4b7c3edb18f422c62792789 100644 (file)
@@ -50,7 +50,7 @@ struct ChannelConf
 struct OptionsConf
 {
    int negcache;
-   int dns_fdlimit;
+   unsigned int dns_fdlimit;
    char *pidfile;
    char *scanlog;
 };
index bbcb4ad537f00dbbb27698af9f4dbfe78972d66d..c20c0e3265a976a3d94009ebb1317177fa54ea93 100644 (file)
@@ -82,7 +82,7 @@ void dnsbl_add(struct scan_struct *ss)
       snprintf(lookup, 128, "%d.%d.%d.%d.%s", d, c, b, a, bl->name);
 #endif
 
-      ds = (struct dnsbl_scan *) MyMalloc(sizeof(struct dnsbl_scan));
+      ds = MyMalloc(sizeof *ds);
       ds->ss = ss;
       ds->bl = bl; 
 
index dd4ea7521b1032afeb50799bf231af27784050ea..b35398dc1c059b9e1c9cccd10c774d8f97b9ae32 100644 (file)
@@ -44,6 +44,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #include "config.h"
 #include "list.h"
 #include "log.h"
+#include "dnsbl.h"
 
 #define FIREDNS_TRIES 3
 #define min(a,b) (a < b ? a : b)
@@ -51,7 +52,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 /* Global variables */
 
 int fdns_errno = FDNS_ERR_NONE;
-int fdns_fdinuse = 0;
+unsigned int fdns_fdinuse = 0;
 
 /* Variables local to this file */
 
@@ -340,7 +341,7 @@ static struct s_connection *firedns_add_query(void)
    struct s_connection *s;
 
    /* create new connection object */
-   s = MyMalloc(sizeof(struct s_connection));
+   s = MyMalloc(sizeof *s);
 
    /* verified by firedns_getresult() */
    s->id[0] = rand() % 255;
@@ -720,15 +721,15 @@ void firedns_cycle(void)
    struct s_connection *p;
    struct firedns_result *res, new_result;
    static struct pollfd *ufds = NULL;
-   int i, fd;
-   unsigned int size;
+   int fd;
+   unsigned int size, i;
    time_t timenow;
 
    if(LIST_SIZE(CONNECTIONS) == 0)
       return;
 
    if(ufds == NULL)
-      ufds = MyMalloc(sizeof(struct pollfd) * OptionsItem->dns_fdlimit);
+      ufds = MyMalloc(sizeof(*ufds) * OptionsItem->dns_fdlimit);
 
    time(&timenow);
    size = 0;
index cdc8e3497f576a55a700778fbddb3bf0d15c5848..2c3e50c3b8a867c6cd81a2a64b5b41e320126f1b 100644 (file)
@@ -74,7 +74,7 @@ struct in6_addr {
 
 /* Used with the above error values */
 extern int fdns_errno;
-extern int fdns_fdinuse;
+extern unsigned int fdns_fdinuse;
 
 void firedns_init(void);
 
index fdcacf70bb748d0bf99fde1b322d90a85ae1a561..a3c30e2408f96b53f6297f1a5055d4142caeaa89 100644 (file)
@@ -106,8 +106,8 @@ int main(int argc, char **argv)
    lenl = strlen(LOGDIR) + strlen(CONFNAME) + strlen(LOGEXT) + 3;
    lenp = strlen(LOGDIR) + strlen(CONFNAME) + strlen(PIDEXT) + 3;
 
-   CONFFILE = (char *) MyMalloc(lenc * sizeof(*CONFFILE));
-   LOGFILE = (char *) MyMalloc(lenl * sizeof(*LOGFILE));
+   CONFFILE = MyMalloc(lenc * sizeof(*CONFFILE));
+   LOGFILE = MyMalloc(lenl * sizeof(*LOGFILE));
 
    snprintf(CONFFILE, lenc, "%s/%s.%s", CONFDIR, CONFNAME, CONFEXT);
    snprintf(LOGFILE, lenl, "%s/%s.%s", LOGDIR, CONFNAME, LOGEXT);
index dea82d6b7130cdc3d59aa1c4dff7863e8245cc59..2a658276e768ae18fb1b8bd0d12d7b805a3d519a 100644 (file)
@@ -189,8 +189,8 @@ void scan_init()
    /* Setup each individual scanner */
    LIST_FOREACH(p, ScannerItemList->head)
    {
-      sc = (struct ScannerConf *) p->data;
-      scs = (struct scanner_struct *) MyMalloc(sizeof(struct scanner_struct));
+      sc = p->data;
+      scs = MyMalloc(sizeof *scs);
 
       if(OPT_DEBUG)
          log_printf("SCAN -> Setting up scanner [%s]", sc->name);
@@ -417,7 +417,7 @@ struct scan_struct *scan_create(char **user, char *msg)
 {
    struct scan_struct *ss;
 
-   ss = (struct scan_struct *) MyMalloc(sizeof(struct scan_struct));
+   ss = MyMalloc(sizeof *ss);
 
    ss->irc_nick = (char *) DupString(user[0]);
    ss->irc_username = (char *) DupString(user[1]);
@@ -944,7 +944,7 @@ void scan_manual(char *param, struct ChannelConf *target)
       scannername++;
    }
 
-   ss = (struct scan_struct *) MyMalloc(sizeof(struct scan_struct));
+   ss = MyMalloc(sizeof *ss);
 
    /* If IP is a hostname, resolve it using gethostbyname (which will block!) */
    if (!(addr = firedns_resolveip4(ip)))