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.
parent e34884e3
......@@ -1280,7 +1280,6 @@ _g_get_unix_mount_points (void)
GList *return_list;
int usermnt = 0;
size_t len = sizeof(usermnt);
struct stat sb;
......@@ -1291,10 +1290,15 @@ _g_get_unix_mount_points (void)
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;
......@@ -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;
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