keep Andy happy, same with sizeof..
A few little warning fixes (with ./configure --extra-fascism), mostly for firedns.
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 */
ScannerItemList = list_create();
/* Init list of Exempts */
- ExemptItem = (struct ExemptConf *) MyMalloc(sizeof(struct ExemptConf));
+ ExemptItem = MyMalloc(sizeof *ExemptItem);
ExemptItem->masks = list_create();
}
struct OptionsConf
{
int negcache;
- int dns_fdlimit;
+ unsigned int dns_fdlimit;
char *pidfile;
char *scanlog;
};
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;
#include "config.h"
#include "list.h"
#include "log.h"
+#include "dnsbl.h"
#define FIREDNS_TRIES 3
#define min(a,b) (a < b ? a : b)
/* Global variables */
int fdns_errno = FDNS_ERR_NONE;
-int fdns_fdinuse = 0;
+unsigned int fdns_fdinuse = 0;
/* Variables local to this file */
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;
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;
/* Used with the above error values */
extern int fdns_errno;
-extern int fdns_fdinuse;
+extern unsigned int fdns_fdinuse;
void firedns_init(void);
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);
/* 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);
{
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]);
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)))