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 committed by Aaron Jones
parent ea3ca814f5
commit ed78e97a96
No known key found for this signature in database
GPG key ID: 8AF0737488AB3012

View file

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