GNOME Bugzilla – Bug 689323
Variable scoping in gunixmounts.c
Last modified: 2017-10-11 12:17:49 UTC
Building glib-2.34.3 on OS X 10.7/64-bit with clang I get a warning: gunixmounts.c:1039:10: warning: unused variable 'len' [-Wunused-variable] size_t len = sizeof(usermnt); ^ 10.6/32-bit is same, just different wording due to different compiler. The declaration of len is based on HAVE_SYS_SYSCTL_H, but then its use is specific to only certain subcases based on other tokens and autoconf results. I have sys/sysctl.h but not the sets of specific tokens that _g_get_unix_mount_points would want to use. Since len is specifically used by individual implementations of sysctl (and friends) and not reused elsewhere, that declaration could be moved into each specific subcase for only those that actually use it. That would bring it in line with how mib[] is scoped.
*** Bug 689324 has been marked as a duplicate of this bug. ***
A patch would be appreciated
Created attachment 235713 [details] [review] Fix variable-scoping
Review of attachment 235713 [details] [review]: That looks good, thanks. Sorry for the delay in reviewing it.