]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use the ARRAY_LENGTH macro more consistently.
authorNick Mathewson <nickm@torproject.org>
Sun, 24 Aug 2014 17:35:48 +0000 (13:35 -0400)
committerNick Mathewson <nickm@torproject.org>
Sun, 24 Aug 2014 17:35:48 +0000 (13:35 -0400)
src/common/tortls.c
src/test/test.c

index 5fe8d81c591d2c1259f933faa30869e84bbbb55d..eda10bbe2e2144a2ae86028a85e28b07f259d2c0 100644 (file)
@@ -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
index 5786f3ca5485cc51386bb1f3a0399c32593f57b6..f1efc3db03a673155ca6ecabb54058a3b106ccdb 100644 (file)
@@ -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