mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
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
This commit is contained in:
parent
e34884e364
commit
b8ccbd9a3c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user