Replace compile-time #ifdef with a runtime check to ensure all code paths are built and tested. This reduces build-time configuration complexity and improves maintainability.
No functional change intended. Signed-off-by: Philippe Mathieu-Daudé <[email protected]> --- net/net.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/net/net.c b/net/net.c index 27e0d278071..11d1f7616a6 100644 --- a/net/net.c +++ b/net/net.c @@ -593,28 +593,26 @@ bool qemu_get_vnet_hash_supported_types(NetClientState *nc, uint32_t *types) int qemu_set_vnet_le(NetClientState *nc, bool is_le) { -#if HOST_BIG_ENDIAN + if (!HOST_BIG_ENDIAN) { + return 0; + } if (!nc || !nc->info->set_vnet_le) { return -ENOSYS; } return nc->info->set_vnet_le(nc, is_le); -#else - return 0; -#endif } int qemu_set_vnet_be(NetClientState *nc, bool is_be) { -#if HOST_BIG_ENDIAN - return 0; -#else + if (HOST_BIG_ENDIAN) { + return 0; + } if (!nc || !nc->info->set_vnet_be) { return -ENOSYS; } return nc->info->set_vnet_be(nc, is_be); -#endif } int qemu_can_receive_packet(NetClientState *nc) -- 2.51.0
