summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2013-08-20 10:12:29 -0700
committerTrevor Norris <trev.norris@gmail.com>2013-08-20 11:07:37 -0700
commited0677f42752fe0ec73b4b200e729b583307361a (patch)
tree93722890d22e29ebc75b1712ea23f69cf1a5d507
parent50cee6ecab869bd406a4a8806906c87a51b0b1b2 (diff)
downloadnode-ed0677f42752fe0ec73b4b200e729b583307361a.tar.gz
smalloc: expose ExternalArraySize
Useful to correctly determine the byte size of the external memory that needs to be allocated for an external array.
-rw-r--r--src/smalloc.cc2
-rw-r--r--src/smalloc.h5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/smalloc.cc b/src/smalloc.cc
index 8100fbf81..d97194b85 100644
--- a/src/smalloc.cc
+++ b/src/smalloc.cc
@@ -69,7 +69,7 @@ static bool using_alloc_cb;
// return size of external array type, or 0 if unrecognized
-static inline size_t ExternalArraySize(enum ExternalArrayType type) {
+size_t ExternalArraySize(enum ExternalArrayType type) {
switch (type) {
case v8::kExternalUnsignedByteArray:
return sizeof(uint8_t);
diff --git a/src/smalloc.h b/src/smalloc.h
index d1b04eb89..029f0d9e5 100644
--- a/src/smalloc.h
+++ b/src/smalloc.h
@@ -42,6 +42,11 @@ static const unsigned int kMaxLength = 0x3fffffff;
NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint);
/**
+ * Return byte size of external array type.
+ */
+NODE_EXTERN size_t ExternalArraySize(enum v8::ExternalArrayType type);
+
+/**
* Allocate external memory and set to passed object. If data is passed then
* will use that instead of allocating new.
*