diff --git a/src/node_buffer.cc b/src/node_buffer.cc index eabe1b9865ee48..f0de2872b024f4 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -193,6 +193,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate) { } +// Parse index for external array data. +inline MUST_USE_RESULT bool ParseArrayIndex(Local arg, + size_t def, + size_t* ret) { + if (arg->IsUndefined()) { + *ret = def; + return true; + } + + int64_t tmp_i = arg->IntegerValue(); + + if (tmp_i < 0) + return false; + + *ret = static_cast(tmp_i); + return true; +} + + // Buffer methods bool HasInstance(Local val) { diff --git a/src/node_internals.h b/src/node_internals.h index d9c2baa7cd67d7..24ea9534bf1e08 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -176,24 +176,6 @@ inline bool IsBigEndian() { return GetEndianness() == kBigEndian; } -// parse index for external array data -inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local arg, - size_t def, - size_t* ret) { - if (arg->IsUndefined()) { - *ret = def; - return true; - } - - int64_t tmp_i = arg->IntegerValue(); - - if (tmp_i < 0) - return false; - - *ret = static_cast(tmp_i); - return true; -} - void ThrowError(v8::Isolate* isolate, const char* errmsg); void ThrowTypeError(v8::Isolate* isolate, const char* errmsg); void ThrowRangeError(v8::Isolate* isolate, const char* errmsg);