Re-worked with bsearch.
* mountlist.c: (ignore_mount_entry): Re-worked with bsearch.
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
2005-01-18 Benoît Dejean <TazForEver@dlfp.org>
|
||||||
|
|
||||||
|
* mountlist.c: (ignore_mount_entry): Re-worked with bsearch.
|
||||||
|
|
||||||
2004-12-09 Benoît Dejean <tazforever@dlfp.org>
|
2004-12-09 Benoît Dejean <tazforever@dlfp.org>
|
||||||
|
|
||||||
* mountlist.c: (ignore_mount_entry): Ignores "unkown" file system type.
|
* mountlist.c: (ignore_mount_entry): Ignores "unkown" file system type.
|
||||||
|
@@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
#if defined(STDC_HEADERS) || defined(HAVE_STRING_H)
|
||||||
@@ -535,31 +536,28 @@ read_filesystem_list (void)
|
|||||||
|
|
||||||
static gboolean ignore_mount_entry(const struct mount_entry *me)
|
static gboolean ignore_mount_entry(const struct mount_entry *me)
|
||||||
{
|
{
|
||||||
|
/* keep sorted */
|
||||||
static const char ignored[][12] = {
|
static const char ignored[][12] = {
|
||||||
|
"autofs",
|
||||||
|
"binfmt_misc",
|
||||||
|
"devpts",
|
||||||
|
"mntfs",
|
||||||
|
"none",
|
||||||
|
"openpromfs",
|
||||||
"proc",
|
"proc",
|
||||||
"procfs",
|
"procfs",
|
||||||
"autofs",
|
|
||||||
"sysfs",
|
|
||||||
"usbfs",
|
|
||||||
"none",
|
|
||||||
"devpts",
|
|
||||||
"usbdevfs",
|
|
||||||
"binfmt_misc",
|
|
||||||
"supermount",
|
"supermount",
|
||||||
"mntfs",
|
"sysfs",
|
||||||
"openpromfs",
|
"unknown",
|
||||||
"unknown"
|
"usbdevfs",
|
||||||
|
"usbfs"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char (*i)[12] = &ignored[0];
|
typedef int (*Comparator)(const void*, const void*);
|
||||||
|
|
||||||
while(i != (&ignored[0] + G_N_ELEMENTS(ignored))) {
|
return bsearch(me->me_type,
|
||||||
if(strcmp(*i, me->me_type) == 0)
|
ignored, G_N_ELEMENTS(ignored), sizeof ignored[0],
|
||||||
return TRUE;
|
(Comparator) strcmp) != NULL;
|
||||||
++i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user