summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-01 15:39:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-01 15:39:53 +0000
commitd2789ab75f534ae4fe665d1ecefec3601d00a9e4 (patch)
treec5ffd5317cdf3cace0aa47bb5ee1ee7d9e29ad9b /lib
parenta918d16c5c56917eca54272018ae30883ed218ec (diff)
There is no need for is{upper,lower}() tests before to{lower,uppper}(),
since all other characters are mapped through transparently. ok jsing
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/asn1/asn_mime.c29
-rw-r--r--lib/libcrypto/x509v3/v3_utl.c6
2 files changed, 8 insertions, 27 deletions
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';