ircd: hostmask: avoid clang static analysis warning

arec->Mask.ipa.bits is unused if arec->masktype == HM_HOST
This commit is contained in:
Simon Arlott 2017-07-29 17:39:28 +01:00
parent b0adc7bf97
commit ab5fc9c032
No known key found for this signature in database
GPG key ID: C8975F2043CA5D24

View file

@ -531,19 +531,18 @@ void
add_conf_by_address(const char *address, int type, const char *username, const char *auth_user, struct ConfItem *aconf)
{
static unsigned long prec_value = 0xFFFFFFFF;
int masktype, bits;
int bits;
unsigned long hv;
struct AddressRec *arec;
if(address == NULL)
address = "/NOMATCH!/";
arec = rb_malloc(sizeof(struct AddressRec));
masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits);
arec->Mask.ipa.bits = bits;
arec->masktype = masktype;
arec->masktype = parse_netmask(address, &arec->Mask.ipa.addr, &bits);
#ifdef RB_IPV6
if(masktype == HM_IPV6)
if(arec->masktype == HM_IPV6)
{
arec->Mask.ipa.bits = bits;
/* We have to do this, since we do not re-hash for every bit -A1kmm. */
bits -= bits % 16;
arec->next = atable[(hv = hash_ipv6((struct sockaddr *)&arec->Mask.ipa.addr, bits))];
@ -551,8 +550,9 @@ add_conf_by_address(const char *address, int type, const char *username, const c
}
else
#endif
if(masktype == HM_IPV4)
if(arec->masktype == HM_IPV4)
{
arec->Mask.ipa.bits = bits;
/* We have to do this, since we do not re-hash for every bit -A1kmm. */
bits -= bits % 8;
arec->next = atable[(hv = hash_ipv4((struct sockaddr *)&arec->Mask.ipa.addr, bits))];