[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Use the ARRAY_LENGTH macro more consistently.



commit 9222707e5c55ae7419d998f46aaa903fdeacb68a
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sun Aug 24 13:35:48 2014 -0400

    Use the ARRAY_LENGTH macro more consistently.
---
 src/common/tortls.c |    3 +--
 src/test/test.c     |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/common/tortls.c b/src/common/tortls.c
index 5fe8d81..eda10bb 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -782,8 +782,7 @@ static const cipher_info_t CLIENT_CIPHER_INFO_LIST[] = {
 };
 
 /** The length of CLIENT_CIPHER_INFO_LIST and CLIENT_CIPHER_DUMMIES. */
-static const int N_CLIENT_CIPHERS =
-  sizeof(CLIENT_CIPHER_INFO_LIST)/sizeof(CLIENT_CIPHER_INFO_LIST[0]);
+static const int N_CLIENT_CIPHERS = ARRAY_LENGTH(CLIENT_CIPHER_INFO_LIST);
 #endif
 
 #ifndef V2_HANDSHAKE_CLIENT
diff --git a/src/test/test.c b/src/test/test.c
index 5786f3c..f1efc3d 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -191,7 +191,7 @@ remove_directory(void)
 #undef CACHE_GENERATED_KEYS
 
 static crypto_pk_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL};
-#define N_PREGEN_KEYS ((int)(sizeof(pregen_keys)/sizeof(pregen_keys[0])))
+#define N_PREGEN_KEYS ARRAY_LENGTH(pregen_keys)
 
 /** Generate and return a new keypair for use in unit tests.  If we're using
  * the key cache optimization, we might reuse keys: we only guarantee that

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits