After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689323 - Variable scoping in gunixmounts.c
Variable scoping in gunixmounts.c
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
2.34.x
Other Mac OS
: Normal minor
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-11-30 04:04 UTC by Daniel Macks
Modified: 2017-10-11 12:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix variable-scoping (1.79 KB, patch)
2013-02-11 16:20 UTC, Daniel Macks
committed Details | Review

Description Daniel Macks 2012-11-30 04:04:07 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.
Comment 1 Matthias Clasen 2012-12-03 04:56:54 UTC
*** Bug 689324 has been marked as a duplicate of this bug. ***
Comment 2 Matthias Clasen 2013-02-05 03:57:02 UTC
A patch would be appreciated
Comment 3 Daniel Macks 2013-02-11 16:20:02 UTC
Created attachment 235713 [details] [review]
Fix variable-scoping
Comment 4 Philip Withnall 2017-10-11 12:13:15 UTC
Review of attachment 235713 [details] [review]:

That looks good, thanks. Sorry for the delay in reviewing it.