diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2011-08-23 18:26:39 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2011-08-24 22:27:24 +0200 |
commit | 7003d6eff56193aa6f2370cafb7f7bf10db243c7 (patch) | |
tree | 93f9d892c69e9f43df0e295f8909f43890135e6d | |
parent | cdbecc48a13c09973f82e77c1cad3b873f8203fa (diff) | |
download | node-new-7003d6eff56193aa6f2370cafb7f7bf10db243c7.tar.gz |
Move ARRAY_SIZE macro to node.h
-rw-r--r-- | src/node.cc | 2 | ||||
-rw-r--r-- | src/node.h | 4 | ||||
-rw-r--r-- | src/node_file.cc | 1 | ||||
-rw-r--r-- | src/node_net.cc | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/src/node.cc b/src/node.cc index ec5f4353b8..5818520934 100644 --- a/src/node.cc +++ b/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__ diff --git a/src/node.h b/src/node.h index 9e816e0c7c..851f0f6107 100644 --- a/src/node.h +++ b/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 diff --git a/src/node_file.cc b/src/node_file.cc index 51c569f2ca..aa751fb613 100644 --- a/src/node_file.cc +++ b/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"))) diff --git a/src/node_net.cc b/src/node_net.cc index d060e9b3d3..3b6fe389e5 100644 --- a/src/node_net.cc +++ b/src/node_net.cc @@ -83,8 +83,6 @@ # define SHUT_RDWR SD_BOTH #endif -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) - namespace node { |