diff mbox series

[uclibc-ng-devel] getaddrinfo.c: Avoid misleading indentation warning

Message ID 20231125230546.8992-1-marcus.haehnel@kernkonzept.com
State Accepted
Headers show
Series [uclibc-ng-devel] getaddrinfo.c: Avoid misleading indentation warning | expand

Commit Message

Marcus Haehnel Nov. 25, 2023, 11:05 p.m. UTC
When compiling getaddrinfo.c with clang the -Wmisleading-indentation
option will cause a warning due to the indentation lining up with the
previous statement in the if block above.

For gcc the warning is blinded by the commented line. See also:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107162

Move the comment behind the function call to make both compilers happy.
---
 libc/inet/getaddrinfo.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index a9000ae13..f34a4726c 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -959,8 +959,7 @@  getaddrinfo(const char *name, const char *service,
 					last_i = i;
 					if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC))
 						continue;
-					/*if (p) - freeaddrinfo works ok on NULL too */
-						freeaddrinfo(p);
+					freeaddrinfo(p); /* freeaddrinfo works ok on NULL too */
 					return -(i & GAIH_EAI);
 				}
 				if (end)