Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move ARRAY_SIZE macro to node.h

  • Loading branch information...
commit 7003d6eff56193aa6f2370cafb7f7bf10db243c7 1 parent cdbecc4
@bnoordhuis bnoordhuis authored
View
2  src/node.cc
@@ -100,8 +100,6 @@ extern "C" {
#include <node_script.h>
#include <v8_typed_array.h>
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
-
using namespace v8;
# ifdef __APPLE__
View
4 src/node.h
@@ -46,6 +46,10 @@
#include <node_object_wrap.h>
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0]))
+#endif
+
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
#define NODE_STRINGIFY_HELPER(n) #n
View
1  src/node_file.cc
@@ -69,7 +69,6 @@ namespace node {
using namespace v8;
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define THROW_BAD_ARGS \
ThrowException(Exception::TypeError(String::New("Bad argument")))
View
2  src/node_net.cc
@@ -83,8 +83,6 @@
# define SHUT_RDWR SD_BOTH
#endif
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a)))
-
namespace node {
Please sign in to comment.
Something went wrong with that request. Please try again.