Author: kevans
Date: Mon Apr 15 21:20:06 2019
New Revision: 346254
URL: https://svnweb.freebsd.org/changeset/base/346254

Log:
  config(8): replace opteq with a call to strcasecmp
  
  This obscures the comparison slightly less; when option name appear in
  files, they are case-insensitive.
  
  MFC after:    1 week

Modified:
  head/usr.sbin/config/mkmakefile.c

Modified: head/usr.sbin/config/mkmakefile.c
==============================================================================
--- head/usr.sbin/config/mkmakefile.c   Mon Apr 15 19:21:45 2019        
(r346253)
+++ head/usr.sbin/config/mkmakefile.c   Mon Apr 15 21:20:06 2019        
(r346254)
@@ -62,7 +62,6 @@ static void do_rules(FILE *);
 static void do_xxfiles(char *, FILE *);
 static void do_objs(FILE *);
 static void do_before_depend(FILE *);
-static int opteq(const char *, const char *);
 static void read_files(void);
 static void sanitize_envline(char *result, const char *src);
 static bool preprocess(char *line, char *result);
@@ -565,7 +564,8 @@ next:
                                goto nextparam;
                        }
                SLIST_FOREACH(op, &opt, op_next)
-                       if (op->op_value == 0 && opteq(op->op_name, wd)) {
+                       if (op->op_value == 0 &&
+                           strcasecmp(op->op_name, wd) == 0) {
                                if (not)
                                        match = 0;
                                goto nextparam;
@@ -625,23 +625,6 @@ read_files(void)
                tnl = STAILQ_NEXT(nl, f_next);
                free(nl->f_name);
                free(nl);
-       }
-}
-
-static int
-opteq(const char *cp, const char *dp)
-{
-       char c, d;
-
-       for (; ; cp++, dp++) {
-               if (*cp != *dp) {
-                       c = isupper(*cp) ? tolower(*cp) : *cp;
-                       d = isupper(*dp) ? tolower(*dp) : *dp;
-                       if (c != d)
-                               return (0);
-               }
-               if (*cp == 0)
-                       return (1);
        }
 }
 


_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to