Commit fbaf0356 authored by David Johnson's avatar David Johnson

Move the ipv4/uint32t STATIC_ASSERT outside function to avoid warning.

parent 192521ff
Pipeline #1933 failed with stage
in 2019 minutes and 9 seconds
......@@ -144,6 +144,8 @@ int cn_dispatch_result_push_item(cn_dispatch_result_t *result,
return 0;
}
STATIC_ASSERT(sizeof(((cn_dispatch_result_item_t *)NULL)->info.ipv4) == sizeof(uint32_t),
item_ipv4_field_32_bits);
int cn_dispatch_result_item_init_info(cn_dispatch_result_item_t *item,
char * name,
......@@ -155,8 +157,7 @@ int cn_dispatch_result_item_init_info(cn_dispatch_result_item_t *item,
if (name != NULL && item->info.name == NULL) {
return -1;
}
STATIC_ASSERT(sizeof(item->info.ipv4) == sizeof(uint32_t),
item_ipv4_filed_32_bits);
uint32_t ipv4_nbo = *((uint32_t *) ipv4);
ipv4_nbo = htonl(ipv4_nbo);
memcpy(item->info.ipv4, &ipv4_nbo, sizeof(ipv4_nbo));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment