diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-15 01:45:14 +0100 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-02-15 01:45:14 +0100 |
| commit | df7f2008c2a3a54437d2678b8d53eddaf136eb89 (patch) | |
| tree | 480cad8bda37e9eabe00b91bfa4f5ff9553defb1 /modutils | |
| parent | 12f44ea18344f66e03e61e621a6c0fd2d36f7595 (diff) | |
| download | busybox-w32-df7f2008c2a3a54437d2678b8d53eddaf136eb89.tar.gz busybox-w32-df7f2008c2a3a54437d2678b8d53eddaf136eb89.tar.bz2 busybox-w32-df7f2008c2a3a54437d2678b8d53eddaf136eb89.zip | |
modinfo: trivial optimizations
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'modutils')
| -rw-r--r-- | modutils/modinfo.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modutils/modinfo.c b/modutils/modinfo.c index cc501825c..db134bd00 100644 --- a/modutils/modinfo.c +++ b/modutils/modinfo.c | |||
| @@ -44,7 +44,7 @@ static int display(const char *data, const char *pattern, int flag) | |||
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static void modinfo(const char *path, const char *version, | 46 | static void modinfo(const char *path, const char *version, |
| 47 | struct modinfo_env *env) | 47 | const struct modinfo_env *env) |
| 48 | { | 48 | { |
| 49 | static const char *const shortcuts[] = { | 49 | static const char *const shortcuts[] = { |
| 50 | "filename", | 50 | "filename", |
| @@ -82,11 +82,13 @@ static void modinfo(const char *path, const char *version, | |||
| 82 | if (field) | 82 | if (field) |
| 83 | tags |= OPT_F; | 83 | tags |= OPT_F; |
| 84 | for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) { | 84 | for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) { |
| 85 | const char *pattern = field; | 85 | const char *pattern; |
| 86 | if ((1<<j) & OPT_TAGS) | 86 | |
| 87 | pattern = shortcuts[j]; | ||
| 88 | if (!((1<<j) & tags)) | 87 | if (!((1<<j) & tags)) |
| 89 | continue; | 88 | continue; |
| 89 | pattern = field; | ||
| 90 | if ((1<<j) & OPT_TAGS) | ||
| 91 | pattern = shortcuts[j]; | ||
| 90 | length = strlen(pattern); | 92 | length = strlen(pattern); |
| 91 | ptr = the_module; | 93 | ptr = the_module; |
| 92 | while (1) { | 94 | while (1) { |
