aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-09-12 15:06:42 +0200
committerDenys Vlasenko <dvlasenk@redhat.com>2010-09-12 15:06:42 +0200
commit2d8187c139985e73349e3cb092ab4ea68a3be034 (patch)
treeb129cbb18cf6405688f98ff82253d68cba0d419c
parentacd5bc8f649fad335d80c5289512b404f08ac8e2 (diff)
downloadbusybox-2d8187c139985e73349e3cb092ab4ea68a3be034.tar.gz
shell/match.c: shrink by dropping double bool inversion
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
-rw-r--r--shell/match.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/shell/match.c b/shell/match.c
index e77c5d732..fee3cf2a8 100644
--- a/shell/match.c
+++ b/shell/match.c
@@ -27,8 +27,6 @@
#include <fnmatch.h>
#include "match.h"
-#define pmatch(a, b) !fnmatch((a), (b), 0)
-
char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags)
{
char *loc;
@@ -67,17 +65,17 @@ char* FAST_FUNC scan_and_match(char *string, const char *pattern, unsigned flags
while (loc != end) {
char c;
- int match;
+ int r;
c = *loc;
if (flags & SCAN_MATCH_LEFT_HALF) {
*loc = '\0';
- match = pmatch(pattern, string);
+ r = fnmatch(pattern, string, 0);
*loc = c;
} else {
- match = pmatch(pattern, loc);
+ r = fnmatch(pattern, loc, 0);
}
- if (match)
+ if (r == 0) /* match found */
return loc;
if (early_exit) {
#ifdef STANDALONE