From ecd5d07b3ae90c7c1c84802e997bfb377e72582b Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 1 Jun 2021 17:32:32 +0200 Subject: [PATCH] glib-aux: move forward declaration of inet_ntop() out of function scope lgtm.com doesn't like this: Query pack:com.lgtm/cpp-queries Query ID:cpp/function-in-block Functions should always be declared at file scope. It is confusing to declare a function at block scope, and the visibility of the function is not what would be expected. --- src/libnm-glib-aux/nm-shared-utils.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libnm-glib-aux/nm-shared-utils.h b/src/libnm-glib-aux/nm-shared-utils.h index ef159576f3..4493e73bd5 100644 --- a/src/libnm-glib-aux/nm-shared-utils.h +++ b/src/libnm-glib-aux/nm-shared-utils.h @@ -452,13 +452,14 @@ nm_utils_ip4_address_is_zeronet(in_addr_t network) #define NM_UTILS_INET_ADDRSTRLEN INET6_ADDRSTRLEN +/* Forward declare function so we don't have to drag in . */ +const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); + static inline const char * nm_utils_inet_ntop(int addr_family, gconstpointer addr, char *dst) { const char *s; - const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); - nm_assert_addr_family(addr_family); nm_assert(addr); nm_assert(dst);