diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2015-05-02 18:30:00 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2015-05-03 12:53:08 +0100 |
commit | b6eb9827a6866981c08cc9613ca8b4a648894fb1 (patch) | |
tree | c5a6351461d8be964bc1f31fa2e34c4ebb7cfafd /crypto/ts | |
parent | 31ff45aa975acb43f1da20e714eadf4649655714 (diff) |
Add OSSL_NELEM macro.
Add OSSL_NELEM macro to e_os.h to determine the number of elements in an
array.
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/ts')
-rw-r--r-- | crypto/ts/ts_rsp_print.c | 3 | ||||
-rw-r--r-- | crypto/ts/ts_rsp_verify.c | 2 |
2 files changed, 2 insertions, 3 deletions
diff --git a/crypto/ts/ts_rsp_print.c b/crypto/ts/ts_rsp_print.c index d64f2f4e4a..0a3e4973c8 100644 --- a/crypto/ts/ts_rsp_print.c +++ b/crypto/ts/ts_rsp_print.c @@ -130,8 +130,7 @@ int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a) /* Printing status code. */ BIO_printf(bio, "Status: "); status = ASN1_INTEGER_get(a->status); - if (0 <= status - && status < (long)(sizeof(status_map) / sizeof(status_map[0]))) + if (0 <= status && status < (long)OSSL_NELEM(status_map)) BIO_printf(bio, "%s\n", status_map[status]); else BIO_printf(bio, "out of bounds\n"); diff --git a/crypto/ts/ts_rsp_verify.c b/crypto/ts/ts_rsp_verify.c index a89f9cbdfa..8381d4148b 100644 --- a/crypto/ts/ts_rsp_verify.c +++ b/crypto/ts/ts_rsp_verify.c @@ -101,7 +101,7 @@ static const char *TS_status_text[] = { "granted", "revocationNotification" }; -#define TS_STATUS_TEXT_SIZE (sizeof(TS_status_text)/sizeof(*TS_status_text)) +#define TS_STATUS_TEXT_SIZE OSSL_NELEM(TS_status_text) /* * This must be greater or equal to the sum of the strings in TS_status_text |