svn commit: r309233 - head/usr.bin/sort

Xin LI delphij at FreeBSD.org
Mon Nov 28 06:36:11 UTC 2016


Author: delphij
Date: Mon Nov 28 06:36:10 2016
New Revision: 309233
URL: https://svnweb.freebsd.org/changeset/base/309233

Log:
  Eliminate variables that are computed, assigned but never
  used.
  
  MFC after:	2 weeks

Modified:
  head/usr.bin/sort/bwstring.c
  head/usr.bin/sort/sort.c

Modified: head/usr.bin/sort/bwstring.c
==============================================================================
--- head/usr.bin/sort/bwstring.c	Mon Nov 28 06:32:05 2016	(r309232)
+++ head/usr.bin/sort/bwstring.c	Mon Nov 28 06:36:10 2016	(r309233)
@@ -910,7 +910,6 @@ bws_month_score(const struct bwstring *s
 
 	if (MB_CUR_MAX == 1) {
 		const unsigned char *end, *s;
-		size_t len;
 
 		s = s0->data.cstr;
 		end = s + s0->len;
@@ -918,8 +917,6 @@ bws_month_score(const struct bwstring *s
 		while (isblank(*s) && s < end)
 			++s;
 
-		len = strlen((const char*)s);
-
 		for (int i = 11; i >= 0; --i) {
 			if (cmonths[i] &&
 			    (s == (unsigned char*)strstr((const char*)s, (char*)(cmonths[i]))))
@@ -928,7 +925,6 @@ bws_month_score(const struct bwstring *s
 
 	} else {
 		const wchar_t *end, *s;
-		size_t len;
 
 		s = s0->data.wstr;
 		end = s + s0->len;
@@ -936,8 +932,6 @@ bws_month_score(const struct bwstring *s
 		while (iswblank(*s) && s < end)
 			++s;
 
-		len = wcslen(s);
-
 		for (int i = 11; i >= 0; --i) {
 			if (wmonths[i] && (s == wcsstr(s, wmonths[i])))
 				return (i);

Modified: head/usr.bin/sort/sort.c
==============================================================================
--- head/usr.bin/sort/sort.c	Mon Nov 28 06:32:05 2016	(r309232)
+++ head/usr.bin/sort/sort.c	Mon Nov 28 06:36:10 2016	(r309233)
@@ -209,14 +209,10 @@ sort_modifier_empty(struct sort_mods *sm
 static void
 usage(bool opt_err)
 {
-	struct option *o;
 	FILE *out;
 
-	out = stdout;
-	o = &(long_options[0]);
+	out = opt_err ? stderr : stdout;
 
-	if (opt_err)
-		out = stderr;
 	fprintf(out, getstr(12), getprogname());
 	if (opt_err)
 		exit(2);


More information about the svn-src-head mailing list