svn commit: r293002 - head/bin/sh

Jilles Tjoelker jilles at FreeBSD.org
Thu Dec 31 20:15:58 UTC 2015


Author: jilles
Date: Thu Dec 31 20:15:57 2015
New Revision: 293002
URL: https://svnweb.freebsd.org/changeset/base/293002

Log:
  sh: Remove redundant CTLQUOTEMARK checks.
  
  With the new expand.c code, the intermediate representation passed to the
  pathname generation code only contains CTLESC, not CTLQUOTEMARK.
  
  CTLQUOTEMARK now only occurs in the text of NARG nodes (output of the
  parser).

Modified:
  head/bin/sh/expand.c

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Thu Dec 31 20:00:53 2015	(r293001)
+++ head/bin/sh/expand.c	Thu Dec 31 20:15:57 2015	(r293002)
@@ -1018,7 +1018,7 @@ static char expdir[PATH_MAX];
 
 /*
  * Perform pathname generation and remove control characters.
- * At this point, the only control characters should be CTLESC and CTLQUOTEMARK.
+ * At this point, the only control characters should be CTLESC.
  * The results are stored in the list dstlist.
  */
 static void
@@ -1083,8 +1083,6 @@ expmeta(char *enddir, char *name, struct
 			if (*q == '!' || *q == '^')
 				q++;
 			for (;;) {
-				while (*q == CTLQUOTEMARK)
-					q++;
 				if (*q == CTLESC)
 					q++;
 				if (*q == '/' || *q == '\0')
@@ -1096,8 +1094,6 @@ expmeta(char *enddir, char *name, struct
 			}
 		} else if (*p == '\0')
 			break;
-		else if (*p == CTLQUOTEMARK)
-			continue;
 		else {
 			if (*p == CTLESC)
 				esc++;
@@ -1112,8 +1108,6 @@ expmeta(char *enddir, char *name, struct
 		if (enddir != expdir)
 			metaflag++;
 		for (p = name ; ; p++) {
-			if (*p == CTLQUOTEMARK)
-				continue;
 			if (*p == CTLESC)
 				p++;
 			*enddir++ = *p;
@@ -1130,8 +1124,6 @@ expmeta(char *enddir, char *name, struct
 	if (start != name) {
 		p = name;
 		while (p < start) {
-			while (*p == CTLQUOTEMARK)
-				p++;
 			if (*p == CTLESC)
 				p++;
 			*enddir++ = *p++;
@@ -1160,8 +1152,6 @@ expmeta(char *enddir, char *name, struct
 	}
 	matchdot = 0;
 	p = start;
-	while (*p == CTLQUOTEMARK)
-		p++;
 	if (*p == CTLESC)
 		p++;
 	if (*p == '.')
@@ -1280,8 +1270,6 @@ patmatch(const char *pattern, const char
 			if (*q++ != *p++)
 				goto backtrack;
 			break;
-		case CTLQUOTEMARK:
-			continue;
 		case '?':
 			if (*q == '\0')
 				return 0;
@@ -1298,7 +1286,7 @@ patmatch(const char *pattern, const char
 			break;
 		case '*':
 			c = *p;
-			while (c == CTLQUOTEMARK || c == '*')
+			while (c == '*')
 				c = *++p;
 			/*
 			 * If the pattern ends here, we know the string
@@ -1342,8 +1330,6 @@ patmatch(const char *pattern, const char
 					c = '[';
 					goto dft;
 				}
-				if (c == CTLQUOTEMARK)
-					continue;
 				if (c == '[' && *p == ':') {
 					found |= match_charclass(p, chr, &end);
 					if (end != NULL)
@@ -1360,8 +1346,6 @@ patmatch(const char *pattern, const char
 					wc = (unsigned char)c;
 				if (*p == '-' && p[1] != ']') {
 					p++;
-					while (*p == CTLQUOTEMARK)
-						p++;
 					if (*p == CTLESC)
 						p++;
 					if (localeisutf8) {


More information about the svn-src-head mailing list