Commit b8ccbd9a authored by Daniel Macks's avatar Daniel Macks Committed by Philip Withnall

Fix variable-scoping to avoid declaring on platforms where not used

"len" is only used by some platforms' implementations (as controlled
by various autoconf/#ifdef tokens) and only in a small codeblock in
those cases, but was declared based on a looser #ifdef heuristic and
in a larger scope. The result is an unused-variable warning when built
on some platforms. Move declaration to the local codeblocks that use
the variable, which also restricts it to the narrower set of platforms
where those codeblocks are used.

https://bugzilla.gnome.org/show_bug.cgi?id=689323
parent e34884e3
......@@ -1280,7 +1280,6 @@ _g_get_unix_mount_points (void)
GList *return_list;
#ifdef HAVE_SYS_SYSCTL_H
int usermnt = 0;
size_t len = sizeof(usermnt);
struct stat sb;
#endif
......@@ -1291,10 +1290,15 @@ _g_get_unix_mount_points (void)
#ifdef HAVE_SYS_SYSCTL_H
#if defined(HAVE_SYSCTLBYNAME)
sysctlbyname ("vfs.usermount", &usermnt, &len, NULL, 0);
{
size_t len = sizeof(usermnt);
sysctlbyname ("vfs.usermount", &usermnt, &len, NULL, 0);
}
#elif defined(CTL_VFS) && defined(VFS_USERMOUNT)
{
int mib[2];
size_t len = sizeof(usermnt);
mib[0] = CTL_VFS;
mib[1] = VFS_USERMOUNT;
......@@ -1303,6 +1307,7 @@ _g_get_unix_mount_points (void)
#elif defined(CTL_KERN) && defined(KERN_USERMOUNT)
{
int mib[2];
size_t len = sizeof(usermnt);
mib[0] = CTL_KERN;
mib[1] = KERN_USERMOUNT;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment