summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-11-21 13:29:13 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-11-21 13:29:13 +0000
commit220c6848dfec8c3ff3cec20c18ff0666e951acac (patch)
tree3d8ffff583f943f8da676939395e8ebd14c59be1
parentc4c367bc31017c412a565baaea4da79639cb1e56 (diff)
remove fancy null check function in favor of checking for null.
from Ricardo Mestre
-rw-r--r--usr.bin/less/funcs.h1
-rw-r--r--usr.bin/less/pattern.c9
-rw-r--r--usr.bin/less/search.c2
3 files changed, 1 insertions, 11 deletions
diff --git a/usr.bin/less/funcs.h b/usr.bin/less/funcs.h
index 09c91cedf5f..5111611abec 100644
--- a/usr.bin/less/funcs.h
+++ b/usr.bin/less/funcs.h
@@ -239,7 +239,6 @@ extern void ierror(const char *, PARG *);
extern int query(const char *, PARG *);
extern int compile_pattern(char *, int, regex_t **);
extern void uncompile_pattern(regex_t **);
-extern int is_null_pattern(void *);
extern int match_pattern(void *, char *, char *, int, char **, char **,
int, int);
extern off_t position(int);
diff --git a/usr.bin/less/pattern.c b/usr.bin/less/pattern.c
index 01c2903420c..36f61c73663 100644
--- a/usr.bin/less/pattern.c
+++ b/usr.bin/less/pattern.c
@@ -74,15 +74,6 @@ uncompile_pattern(regex_t **pattern)
}
/*
- * Is a compiled pattern null?
- */
-int
-is_null_pattern(void *pattern)
-{
- return (pattern == NULL);
-}
-
-/*
* Simple pattern matching function.
* It supports no metacharacters like *, etc.
*/
diff --git a/usr.bin/less/search.c b/usr.bin/less/search.c
index 7c7b5a3408e..f8b379875ee 100644
--- a/usr.bin/less/search.c
+++ b/usr.bin/less/search.c
@@ -177,7 +177,7 @@ static int
prev_pattern(struct pattern_info *info)
{
if ((info->search_type & SRCH_NO_REGEX) == 0)
- return (!is_null_pattern(info->compiled));
+ return (info->compiled != NULL);
return (info->text != NULL);
}