Skip to content

Commit e1f961d

Browse files
bnoordhuisMylesBorins
authored andcommitted
src: move ParseArrayIndex() to src/node_buffer.cc
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]>
1 parent 7409c33 commit e1f961d

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/node_buffer.cc

+19
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local<Object> object) {
171171
}
172172

173173

174+
// Parse index for external array data.
175+
inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> arg,
176+
size_t def,
177+
size_t* ret) {
178+
if (arg->IsUndefined()) {
179+
*ret = def;
180+
return true;
181+
}
182+
183+
int64_t tmp_i = arg->IntegerValue();
184+
185+
if (tmp_i < 0)
186+
return false;
187+
188+
*ret = static_cast<size_t>(tmp_i);
189+
return true;
190+
}
191+
192+
174193
// Buffer methods
175194

176195
bool HasInstance(Local<Value> val) {

src/node_internals.h

-18
Original file line numberDiff line numberDiff line change
@@ -160,24 +160,6 @@ inline bool IsBigEndian() {
160160
return GetEndianness() == kBigEndian;
161161
}
162162

163-
// parse index for external array data
164-
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> arg,
165-
size_t def,
166-
size_t* ret) {
167-
if (arg->IsUndefined()) {
168-
*ret = def;
169-
return true;
170-
}
171-
172-
int32_t tmp_i = arg->Int32Value();
173-
174-
if (tmp_i < 0)
175-
return false;
176-
177-
*ret = static_cast<size_t>(tmp_i);
178-
return true;
179-
}
180-
181163
void ThrowError(v8::Isolate* isolate, const char* errmsg);
182164
void ThrowTypeError(v8::Isolate* isolate, const char* errmsg);
183165
void ThrowRangeError(v8::Isolate* isolate, const char* errmsg);

0 commit comments

Comments
 (0)