Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:07:26 -0000
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r346587 - in stable: 11/usr.sbin/config 12/usr.sbin/config
Message-ID:  <201904230237.x3N2bCfN031128@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Tue Apr 23 02:37:12 2019
New Revision: 346587
URL: https://svnweb.freebsd.org/changeset/base/346587

Log:
  MFC r346254: 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.

Modified:
  stable/11/usr.sbin/config/mkmakefile.c
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/12/usr.sbin/config/mkmakefile.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/11/usr.sbin/config/mkmakefile.c
==============================================================================
--- stable/11/usr.sbin/config/mkmakefile.c	Tue Apr 23 02:29:08 2019	(r346586)
+++ stable/11/usr.sbin/config/mkmakefile.c	Tue Apr 23 02:37:12 2019	(r346587)
@@ -60,7 +60,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);
@@ -563,7 +562,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;
@@ -623,23 +623,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);
 	}
 }
 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201904230237.x3N2bCfN031128>