diff options
author | Rich Salz <rsalz@akamai.com> | 2015-05-04 18:00:15 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-05-05 22:18:59 -0400 |
commit | 16f8d4ebf0fd4847fa83d9c61f4150273cb4f533 (patch) | |
tree | 3c30094cad38433c24008c30efe3d93cf38d8ae9 /ssl/ssl_cert.c | |
parent | 12048657a91b12e499d03ec9ff406b42aba67366 (diff) |
memset, memcpy, sizeof consistency fixes
Just as with the OPENSSL_malloc calls, consistently use sizeof(*ptr)
for memset and memcpy. Remove needless casts for those functions.
For memset, replace alternative forms of zero with 0.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'ssl/ssl_cert.c')
-rw-r--r-- | ssl/ssl_cert.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index c7a2aa9957..38e7b822e5 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -188,7 +188,7 @@ CERT *ssl_cert_new(void) SSLerr(SSL_F_SSL_CERT_NEW, ERR_R_MALLOC_FAILURE); return (NULL); } - memset(ret, 0, sizeof(CERT)); + memset(ret, 0, sizeof(*ret)); ret->key = &(ret->pkeys[SSL_PKEY_RSA_ENC]); ret->references = 1; @@ -209,14 +209,9 @@ CERT *ssl_cert_dup(CERT *cert) return (NULL); } - memset(ret, 0, sizeof(CERT)); - - ret->key = &ret->pkeys[cert->key - &cert->pkeys[0]]; - /* - * or ret->key = ret->pkeys + (cert->key - cert->pkeys), if you find that - * more readable - */ + memset(ret, 0, sizeof(*ret)); + ret->key = &ret->pkeys[cert->key - cert->pkeys]; ret->valid = cert->valid; ret->mask_k = cert->mask_k; ret->mask_a = cert->mask_a; |