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).
This commit is contained in:
Nick Mathewson 2010-07-31 17:10:04 -04:00
parent 840a72fbd5
commit 42a8c71112
2 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -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