more use const for interface of libbb/compare_string_array, example usage for e2fspro...
author"Vladimir N. Oleynik" <dzo@simtreas.ru>
Sat, 26 Nov 2005 10:33:55 +0000 (10:33 -0000)
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>
Sat, 26 Nov 2005 10:33:55 +0000 (10:33 -0000)
e2fsprogs/fsck.c
include/libbb.h
libbb/compare_string_array.c

index b7e25d68a8e6cdb78b70ad4a076091e0b6316d52..ae4e3d0c8f750ff2656da59affdefbc112ff7e98 100644 (file)
@@ -988,8 +988,7 @@ static int fs_match(struct fs_info *fs, struct fs_type_compile *cmp)
 /* Check if we should ignore this filesystem. */
 static int ignore(struct fs_info *fs)
 {
-       const char * const *ip;
-       int wanted = 0;
+       int wanted;
        char *s;
 
        /*
@@ -1007,15 +1006,11 @@ static int ignore(struct fs_info *fs)
        if (!fs_match(fs, &fs_type_compiled)) return 1;
 
        /* Are we ignoring this type? */
-       for(ip = ignored_types; *ip; ip++)
-               if (strcmp(fs->type, *ip) == 0) return 1;
+       if(compare_string_array(ignored_types, fs->type))
+               return 1;
 
        /* Do we really really want to check this fs? */
-       for(ip = really_wanted; *ip; ip++)
-               if (strcmp(fs->type, *ip) == 0) {
-                       wanted = 1;
-                       break;
-               }
+       wanted = compare_string_array(really_wanted, fs->type);
 
        /* See if the <fsck.fs> program is available. */
        s = find_fsck(fs->type);
index b7dd48775be1dc39333de2784b662128f58ead8e..70a9336d88e565f54b6ad500e0028ea4c07f8350 100644 (file)
@@ -466,7 +466,7 @@ typedef struct {
 } procps_status_t;
 
 extern procps_status_t * procps_scan(int save_user_arg0);
-extern unsigned short compare_string_array(const char *string_array[], const char *key);
+extern unsigned short compare_string_array(const char * const string_array[], const char *key);
 
 extern int my_query_module(const char *name, int which, void **buf, size_t *bufsize, size_t *ret);
 
index 993b46266c05e6a2234d9ecaaf87f7277d20a1a8..8961e003e5569279ac8924aa7e7d8f16ed3951f9 100644 (file)
@@ -17,7 +17,8 @@
 #include <string.h>
 
 /* returns the array number of the string */
-extern unsigned short compare_string_array(const char *string_array[], const char *key)
+extern unsigned short 
+compare_string_array(const char * const string_array[], const char *key)
 {
        unsigned short i;