From 42a8c7111264ff1469083e50bd5b0c0ee494725b Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sat, 31 Jul 2010 17:10:04 -0400 Subject: [PATCH] Build more cleanly with NetBSDs that dislike toupper(char) To be fair, when char can be signed, if toupper doesn't take negative characters, toupper(char) is a very bad idea. So let's just use the nice safe EVUTIL_TOUPPER instead. (It explicitly only upcases ASCII, but we only use it for identifiers that we know to be ASCII anyway). --- event.c | 3 ++- test/regress.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/event.c b/event.c index 176cc880..6d66f931 100644 --- a/event.c +++ b/event.c @@ -67,6 +67,7 @@ #include "iocp-internal.h" #include "changelist-internal.h" #include "ht-internal.h" +#include "util-internal.h" #ifdef _EVENT_HAVE_EVENT_PORTS extern const struct eventop evportops; @@ -446,7 +447,7 @@ event_is_method_disabled(const char *name) evutil_snprintf(environment, sizeof(environment), "EVENT_NO%s", name); for (i = 8; environment[i] != '\0'; ++i) - environment[i] = toupper(environment[i]); + environment[i] = EVUTIL_TOUPPER(environment[i]); /* Note that evutil_getenv() ignores the environment entirely if * we're setuid */ return (evutil_getenv(environment) != NULL); diff --git a/test/regress.c b/test/regress.c index dacda068..82c7c3b6 100644 --- a/test/regress.c +++ b/test/regress.c @@ -1875,7 +1875,7 @@ methodname_to_envvar(const char *mname, char *buf, size_t buflen) char *cp; evutil_snprintf(buf, buflen, "EVENT_NO%s", mname); for (cp = buf; *cp; ++cp) { - *cp = toupper(*cp); + *cp = EVUTIL_TOUPPER(*cp); } } #endif -- 2.40.0