diff options
author | delphij <delphij@FreeBSD.org> | 2016-12-12 00:47:12 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2016-12-12 00:47:12 +0000 |
commit | 83af890077ce3ead0ad2fb3596dce9d63c7c57a6 (patch) | |
tree | 6a9821016157c1c46908f6ce6a27ecc615025ad2 | |
parent | 33726319e9fc70ba903ad27ef6e76ddfeb7386b1 (diff) | |
download | FreeBSD-src-83af890077ce3ead0ad2fb3596dce9d63c7c57a6.zip FreeBSD-src-83af890077ce3ead0ad2fb3596dce9d63c7c57a6.tar.gz |
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.
-rw-r--r-- | usr.bin/sort/bwstring.c | 6 | ||||
-rw-r--r-- | usr.bin/sort/sort.c | 10 |
2 files changed, 2 insertions, 14 deletions
diff --git a/usr.bin/sort/bwstring.c b/usr.bin/sort/bwstring.c index ca01896..497947c 100644 --- a/usr.bin/sort/bwstring.c +++ b/usr.bin/sort/bwstring.c @@ -910,7 +910,6 @@ bws_month_score(const struct bwstring *s0) 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 *s0) 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 *s0) } 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 *s0) 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); diff --git a/usr.bin/sort/sort.c b/usr.bin/sort/sort.c index 027cdac..089fb5f 100644 --- a/usr.bin/sort/sort.c +++ b/usr.bin/sort/sort.c @@ -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) { |