[tor-commits] [tor/master] Move ARRAY_LENGTH to compiler_compat.h

nickm at torproject.org nickm at torproject.org
Tue Jun 26 15:27:41 UTC 2018


commit 1e07b4031e2613826cf7ff2838a2f0c8f03e81c2
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jun 22 08:41:57 2018 -0400

    Move ARRAY_LENGTH to compiler_compat.h
---
 src/common/util.h            | 2 --
 src/lib/cc/compat_compiler.h | 3 +++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/common/util.h b/src/common/util.h
index f2df84b19..8977b460b 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -451,6 +451,4 @@ STATIC int format_helper_exit_status(unsigned char child_state,
 
 #endif /* defined(UTIL_PRIVATE) */
 
-#define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))
-
 #endif /* !defined(TOR_UTIL_H) */
diff --git a/src/lib/cc/compat_compiler.h b/src/lib/cc/compat_compiler.h
index 763c3d06d..67d945cfa 100644
--- a/src/lib/cc/compat_compiler.h
+++ b/src/lib/cc/compat_compiler.h
@@ -253,4 +253,7 @@
  */
 #define STRUCT_VAR_P(st, off) ((void*) ( ((char*)(st)) + (off) ) )
 
+/** Macro: Yields the number of elements in array x. */
+#define ARRAY_LENGTH(x) ((sizeof(x)) / sizeof(x[0]))
+
 #endif /* !defined(TOR_COMPAT_H) */





More information about the tor-commits mailing list