Skip to content

Commit

Permalink
src: move ParseArrayIndex() to src/node_buffer.cc
Browse files Browse the repository at this point in the history
It's not used anywhere else so move it out of src/node_internals.h.

PR-URL: #7497
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>

Conflicts:
	src/node_internals.h
  • Loading branch information
bnoordhuis authored and cjihrig committed Aug 10, 2016
1 parent da9bd2f commit c730a5d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
19 changes: 19 additions & 0 deletions src/node_buffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate) {
}


// Parse index for external array data.
inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> 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<size_t>(tmp_i);
return true;
}


// Buffer methods

bool HasInstance(Local<Value> val) {
Expand Down
18 changes: 0 additions & 18 deletions src/node_internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,24 +176,6 @@ inline bool IsBigEndian() {
return GetEndianness() == kBigEndian;
}

// parse index for external array data
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> 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<size_t>(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);
Expand Down

0 comments on commit c730a5d

Please sign in to comment.