There's no need to have a handrolled function for a simple compare that
is just used once throughout all the source, or should it be kept for
code readability?

Index: funcs.h
===================================================================
RCS file: /cvs/src/usr.bin/less/funcs.h,v
retrieving revision 1.13
diff -u -p -u -r1.13 funcs.h
--- funcs.h     13 Nov 2015 16:48:48 -0000      1.13
+++ funcs.h     21 Nov 2015 12:12:58 -0000
@@ -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);
Index: search.c
===================================================================
RCS file: /cvs/src/usr.bin/less/search.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 search.c
--- search.c    9 Nov 2015 16:39:13 -0000       1.13
+++ search.c    21 Nov 2015 12:13:09 -0000
@@ -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);
 }

Index: pattern.c
===================================================================
RCS file: /cvs/src/usr.bin/less/pattern.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 pattern.c
--- pattern.c   9 Nov 2015 16:39:13 -0000       1.8
+++ pattern.c   21 Nov 2015 12:13:20 -0000
@@ -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.
  */

Reply via email to