mirror of
https://github.com/zeek/zeek.git
synced 2025-10-01 22:28:20 +00:00
src/3rdparty: Fix GCC 12.2 warning in access to patricia_t members
Access to members of the larger prefix_t, while safe, throws warnings when the compiler knows it previously allocated the smaller prefix4_t. Adapted from 11ae12079ca716f8cfac42cccfd905dad45da18f in the upstream repo.
This commit is contained in:
parent
01c31e9917
commit
3e4512bc80
1 changed files with 6 additions and 4 deletions
10
src/3rdparty/patricia.c
vendored
10
src/3rdparty/patricia.c
vendored
|
@ -209,6 +209,7 @@ prefix_t *New_Prefix2(int family, void *dest, int bitlen, prefix_t *prefix)
|
|||
{
|
||||
int dynamic_allocated = 0;
|
||||
int default_bitlen = sizeof(struct in_addr) * 8;
|
||||
prefix4_t *p4 = NULL;
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
if (family == AF_INET6) {
|
||||
|
@ -243,11 +244,12 @@ prefix_t *New_Prefix2(int family, void *dest, int bitlen, prefix_t *prefix)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
prefix->bitlen = (bitlen >= 0) ? bitlen : default_bitlen;
|
||||
prefix->family = family;
|
||||
prefix->ref_count = 0;
|
||||
p4 = (prefix4_t*) prefix;
|
||||
p4->bitlen = (bitlen >= 0) ? bitlen : default_bitlen;
|
||||
p4->family = family;
|
||||
p4->ref_count = 0;
|
||||
if (dynamic_allocated) {
|
||||
prefix->ref_count++;
|
||||
p4->ref_count++;
|
||||
}
|
||||
/* fprintf(stderr, "[C %s, %d]\n", prefix_toa (prefix), prefix->ref_count);
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue