Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Dec 2016 00:47:12 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r309862 - stable/10/usr.bin/sort
Message-ID:  <201612120047.uBC0lCC0029618@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Mon Dec 12 00:47:12 2016
New Revision: 309862
URL: https://svnweb.freebsd.org/changeset/base/309862

Log:
  MFC r309232-309234:
  
  r309232: Fix an obvious typo.
  r309233: Eliminate variables that are computed, assigned but
           never used.
  r309234: pages and psize are always assigned, so there is no
           need to initialize them as zero.

Modified:
  stable/10/usr.bin/sort/bwstring.c
  stable/10/usr.bin/sort/sort.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.bin/sort/bwstring.c
==============================================================================
--- stable/10/usr.bin/sort/bwstring.c	Mon Dec 12 00:45:43 2016	(r309861)
+++ stable/10/usr.bin/sort/bwstring.c	Mon Dec 12 00:47:12 2016	(r309862)
@@ -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: stable/10/usr.bin/sort/sort.c
==============================================================================
--- stable/10/usr.bin/sort/sort.c	Mon Dec 12 00:45:43 2016	(r309861)
+++ stable/10/usr.bin/sort/sort.c	Mon Dec 12 00:47:12 2016	(r309862)
@@ -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);
@@ -271,8 +267,6 @@ set_hw_params(void)
 {
 	long pages, psize;
 
-	pages = psize = 0;
-
 #if defined(SORT_THREADS)
 	ncpu = 1;
 #endif
@@ -280,7 +274,7 @@ set_hw_params(void)
 	pages = sysconf(_SC_PHYS_PAGES);
 	if (pages < 1) {
 		perror("sysconf pages");
-		psize = 1;
+		pages = 1;
 	}
 	psize = sysconf(_SC_PAGESIZE);
 	if (psize < 1) {



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