summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-02-15 00:45:14 (GMT)
committer Denys Vlasenko <vda.linux@googlemail.com>2011-02-15 00:45:14 (GMT)
commitdf7f2008c2a3a54437d2678b8d53eddaf136eb89 (patch)
tree480cad8bda37e9eabe00b91bfa4f5ff9553defb1
parent12f44ea18344f66e03e61e621a6c0fd2d36f7595 (diff)
downloadbusybox-df7f2008c2a3a54437d2678b8d53eddaf136eb89.tar.gz
busybox-df7f2008c2a3a54437d2678b8d53eddaf136eb89.tar.bz2
modinfo: trivial optimizations
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--modutils/modinfo.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index cc50182..db134bd 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -44,7 +44,7 @@ static int display(const char *data, const char *pattern, int flag)
}
static void modinfo(const char *path, const char *version,
- struct modinfo_env *env)
+ const struct modinfo_env *env)
{
static const char *const shortcuts[] = {
"filename",
@@ -82,11 +82,13 @@ static void modinfo(const char *path, const char *version,
if (field)
tags |= OPT_F;
for (j = 1; (1<<j) & (OPT_TAGS + OPT_F); j++) {
- const char *pattern = field;
- if ((1<<j) & OPT_TAGS)
- pattern = shortcuts[j];
+ const char *pattern;
+
if (!((1<<j) & tags))
continue;
+ pattern = field;
+ if ((1<<j) & OPT_TAGS)
+ pattern = shortcuts[j];
length = strlen(pattern);
ptr = the_module;
while (1) {