diff options
author | "Vladimir N. Oleynik" | 2005-11-26 10:33:55 +0000 |
---|---|---|
committer | "Vladimir N. Oleynik" | 2005-11-26 10:33:55 +0000 |
commit | 61ff4b39738085d1b88d934f619b840fd296c8a8 (patch) | |
tree | 3f0e8887aeecd290f7c32ae413ee6e720733c94b | |
parent | 4eb2fd6826aa197dcdbf3618fa0cae9d2de73d86 (diff) | |
download | busybox-61ff4b39738085d1b88d934f619b840fd296c8a8.zip busybox-61ff4b39738085d1b88d934f619b840fd296c8a8.tar.gz |
more use const for interface of libbb/compare_string_array, example usage for e2fsprogs/fsck
-rw-r--r-- | e2fsprogs/fsck.c | 13 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | libbb/compare_string_array.c | 3 |
3 files changed, 7 insertions, 11 deletions
diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index b7e25d6..ae4e3d0 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -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); diff --git a/include/libbb.h b/include/libbb.h index b7dd487..70a9336 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -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); diff --git a/libbb/compare_string_array.c b/libbb/compare_string_array.c index 993b462..8961e00 100644 --- a/libbb/compare_string_array.c +++ b/libbb/compare_string_array.c @@ -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; |