Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Jul 2016 08:13:09 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302712 - in head/bin/sh: . tests/builtins
Message-ID:  <201607130813.u6D8DAcs061147@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Wed Jul 13 08:13:09 2016
New Revision: 302712
URL: https://svnweb.freebsd.org/changeset/base/302712

Log:
  After removing collation for [a-z] ranges in r302512, do it here too.
  
  Approved by:    jilles

Modified:
  head/bin/sh/expand.c
  head/bin/sh/tests/builtins/case7.0

Modified: head/bin/sh/expand.c
==============================================================================
--- head/bin/sh/expand.c	Wed Jul 13 07:56:01 2016	(r302711)
+++ head/bin/sh/expand.c	Wed Jul 13 08:13:09 2016	(r302712)
@@ -107,7 +107,6 @@ static void expmeta(char *, char *, stru
 static int expsortcmp(const void *, const void *);
 static int patmatch(const char *, const char *);
 static void cvtnum(int, char *);
-static int collate_range_cmp(wchar_t, wchar_t);
 
 void
 emptyarglist(struct arglist *list)
@@ -138,16 +137,6 @@ appendarglist(struct arglist *list, char
 	list->args[list->count++] = str;
 }
 
-static int
-collate_range_cmp(wchar_t c1, wchar_t c2)
-{
-	static wchar_t s1[2], s2[2];
-
-	s1[0] = c1;
-	s2[0] = c2;
-	return (wcscoll(s1, s2));
-}
-
 static char *
 stputs_quotes(const char *data, const char *syntax, char *p)
 {
@@ -1359,9 +1348,7 @@ patmatch(const char *pattern, const char
 							return 0;
 					} else
 						wc2 = (unsigned char)*p++;
-					if (   collate_range_cmp(chr, wc) >= 0
-					    && collate_range_cmp(chr, wc2) <= 0
-					   )
+					if (wc <= chr && chr <= wc2)
 						found = 1;
 				} else {
 					if (chr == wc)

Modified: head/bin/sh/tests/builtins/case7.0
==============================================================================
--- head/bin/sh/tests/builtins/case7.0	Wed Jul 13 07:56:01 2016	(r302711)
+++ head/bin/sh/tests/builtins/case7.0	Wed Jul 13 08:13:09 2016	(r302712)
@@ -14,11 +14,6 @@ c1=e
 c2=$(printf '\366')
 
 case $c1$c2 in
-[a-z][a-z]) ;;
-*) echo wrong at $LINENO ;;
-esac
-
-case $c1$c2 in
-[a-f][n-p]) ;;
+[a-z][!a-z]) ;;
 *) echo wrong at $LINENO ;;
 esac



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