summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-29 13:56:02 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2007-03-29 13:56:02 +0000
commit307d27df4fae76445708378561fb6f91ed70d76b (patch)
treea579f6be2e16862c1819ef0a2af000758f77101b
parent557b458767f8cd90877630b3520933850ad9459d (diff)
- remove bloated switch statement.
text data bss dec hex filename 2706 1 12 2719 a9f find.o.r18273 2605 1 12 2618 a3a find.o.r18274
-rw-r--r--findutils/find.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/findutils/find.c b/findutils/find.c
index 453ed4b1c..f94bd2367 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -295,31 +295,22 @@ static int find_type(const char *type)
{
int mask = 0;
- switch (type[0]) {
- case 'b':
+ if (*type == 'b')
mask = S_IFBLK;
- break;
- case 'c':
+ else if (*type == 'c')
mask = S_IFCHR;
- break;
- case 'd':
+ else if (*type == 'd')
mask = S_IFDIR;
- break;
- case 'p':
+ else if (*type == 'p')
mask = S_IFIFO;
- break;
- case 'f':
+ else if (*type == 'f')
mask = S_IFREG;
- break;
- case 'l':
+ else if (*type == 'l')
mask = S_IFLNK;
- break;
- case 's':
+ else if (*type == 's')
mask = S_IFSOCK;
- break;
- }
- if (mask == 0 || type[1] != '\0')
+ if (mask == 0 || *(type + 1) != '\0')
bb_error_msg_and_die(bb_msg_invalid_arg, type, "-type");
return mask;