From d2789ab75f534ae4fe665d1ecefec3601d00a9e4 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sun, 1 Jun 2014 15:39:53 +0000 Subject: There is no need for is{upper,lower}() tests before to{lower,uppper}(), since all other characters are mapped through transparently. ok jsing --- lib/libcrypto/asn1/asn_mime.c | 29 ++++++----------------------- lib/libcrypto/x509v3/v3_utl.c | 6 ++---- 2 files changed, 8 insertions(+), 27 deletions(-) (limited to 'lib') diff --git a/lib/libcrypto/asn1/asn_mime.c b/lib/libcrypto/asn1/asn_mime.c index f123a7ddc0a..d3bc90665fa 100644 --- a/lib/libcrypto/asn1/asn_mime.c +++ b/lib/libcrypto/asn1/asn_mime.c @@ -826,29 +826,18 @@ mime_hdr_new(char *name, char *value) { MIME_HEADER *mhdr; char *tmpname = NULL, *tmpval = NULL, *p; - int c; if (name) { if (!(tmpname = BUF_strdup(name))) goto err; - for (p = tmpname; *p; p++) { - c = (unsigned char)*p; - if (isupper(c)) { - c = tolower(c); - *p = c; - } - } + for (p = tmpname; *p; p++) + *p = tolower((unsigned char)*p); } if (value) { if (!(tmpval = BUF_strdup(value))) goto err; - for (p = tmpval; *p; p++) { - c = (unsigned char)*p; - if (isupper(c)) { - c = tolower(c); - *p = c; - } - } + for (p = tmpval; *p; p++) + *p = tolower((unsigned char)*p); } mhdr = malloc(sizeof(MIME_HEADER)); if (!mhdr) @@ -870,20 +859,14 @@ static int mime_hdr_addparam(MIME_HEADER *mhdr, char *name, char *value) { char *tmpname = NULL, *tmpval = NULL, *p; - int c; MIME_PARAM *mparam; if (name) { tmpname = BUF_strdup(name); if (!tmpname) goto err; - for (p = tmpname; *p; p++) { - c = (unsigned char)*p; - if (isupper(c)) { - c = tolower(c); - *p = c; - } - } + for (p = tmpname; *p; p++) + *p = tolower((unsigned char)*p); } if (value) { tmpval = BUF_strdup(value); diff --git a/lib/libcrypto/x509v3/v3_utl.c b/lib/libcrypto/x509v3/v3_utl.c index bf6f81a5e9b..4f4dc15221e 100644 --- a/lib/libcrypto/x509v3/v3_utl.c +++ b/lib/libcrypto/x509v3/v3_utl.c @@ -468,10 +468,8 @@ string_to_hex(const char *str, long *len) free(hexbuf); return NULL; } - if (isupper(ch)) - ch = tolower(ch); - if (isupper(cl)) - cl = tolower(cl); + ch = tolower(ch); + cl = tolower(cl); if ((ch >= '0') && (ch <= '9')) ch -= '0'; -- cgit v1.2.3