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/objects/obj_xref.c | |
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/objects/obj_xref.c')
-rw-r--r-- | crypto/objects/obj_xref.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c index b752a2c5be..10ce6397d6 100644 --- a/crypto/objects/obj_xref.c +++ b/crypto/objects/obj_xref.c @@ -59,6 +59,7 @@ #include <openssl/objects.h> #include "obj_xref.h" +#include "e_os.h" DECLARE_STACK_OF(nid_triple) STACK_OF(nid_triple) *sig_app, *sigx_app; @@ -102,8 +103,7 @@ int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) } #ifndef OBJ_XREF_TEST2 if (rv == NULL) { - rv = OBJ_bsearch_sig(&tmp, sigoid_srt, - sizeof(sigoid_srt) / sizeof(nid_triple)); + rv = OBJ_bsearch_sig(&tmp, sigoid_srt, OSSL_NELEM(sigoid_srt)); } #endif if (rv == NULL) @@ -133,9 +133,7 @@ int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) } #ifndef OBJ_XREF_TEST2 if (rv == NULL) { - rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, - sizeof(sigoid_srt_xref) / sizeof(nid_triple *) - ); + rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref)); } #endif if (rv == NULL) @@ -198,12 +196,12 @@ main() int i, rv; # ifdef OBJ_XREF_TEST2 - for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) { + for (i = 0; i < OSSL_NELEM(sigoid_srt); i++) { OBJ_add_sigid(sigoid_srt[i][0], sigoid_srt[i][1], sigoid_srt[i][2]); } # endif - for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) { + for (i = 0; i < OSSL_NELEM(sigoid_srt); i++) { n1 = sigoid_srt[i][0]; rv = OBJ_find_sigid_algs(n1, &n2, &n3); printf("Forward: %d, %s %s %s\n", rv, |