summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschwarze <schwarze@openbsd.org>2019-03-10 20:45:11 +0000
committerschwarze <schwarze@openbsd.org>2019-03-10 20:45:11 +0000
commita29693414a4b354ae2d9f147056435872bdeba9b (patch)
treeebd6537b7b26812c6aebb27b3678d6922d616765
parentDelete a useless call to setlocale(3): strptime(3) is only called (diff)
downloadwireguard-openbsd-a29693414a4b354ae2d9f147056435872bdeba9b.tar.xz
wireguard-openbsd-a29693414a4b354ae2d9f147056435872bdeba9b.zip
Delete useless call to setlocale(3):
Spell uses nothing locale-dependent, and it will never need support for non-English characters because the basic algorithms used are specific to the English language in the first place. While here, make usage() static and return from main() rather than exit(3). Minimially tweaked diff originally from Jan Stary. OK tedu@
-rw-r--r--usr.bin/spell/spellprog.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/usr.bin/spell/spellprog.c b/usr.bin/spell/spellprog.c
index c04153fbcab..1cc32e8001b 100644
--- a/usr.bin/spell/spellprog.c
+++ b/usr.bin/spell/spellprog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spellprog.c,v 1.13 2017/07/28 17:16:35 nicm Exp $ */
+/* $OpenBSD: spellprog.c,v 1.14 2019/03/10 20:45:11 schwarze Exp $ */
/*
* Copyright (c) 1991, 1993
@@ -72,7 +72,6 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
-#include <locale.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -108,7 +107,7 @@ char *estrdup(const char *);
void ise(void);
void print_word(FILE *);
void ztos(char *);
-__dead void usage(void);
+static void __dead usage(void);
/* from look.c */
int look(unsigned char *, unsigned char *, unsigned char *);
@@ -247,8 +246,6 @@ main(int argc, char **argv)
struct stat sb;
FILE *file, *found;
- setlocale(LC_ALL, "");
-
if (pledge("stdio rpath wpath cpath", NULL) == -1)
err(1, "pledge");
@@ -316,7 +313,7 @@ main(int argc, char **argv)
if (ch == EOF) {
if (found != NULL)
fclose(found);
- exit(0);
+ return (0);
}
}
for (cp = word, dp = original; cp < ep; )
@@ -345,7 +342,7 @@ lcase:
file = stdout;
}
- exit(0);
+ return (0);
}
void
@@ -788,7 +785,7 @@ dict(char *bp, char *ep)
return (rval);
}
-__dead void
+static void __dead
usage(void)
{
extern char *__progname;