Skip to content

Commit 6ae2043

Browse files
committed
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 af273b5 commit 6ae2043

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
@@ -193,6 +193,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate) {
193193
}
194194

195195

196+
// Parse index for external array data.
197+
inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> arg,
198+
size_t def,
199+
size_t* ret) {
200+
if (arg->IsUndefined()) {
201+
*ret = def;
202+
return true;
203+
}
204+
205+
int64_t tmp_i = arg->IntegerValue();
206+
207+
if (tmp_i < 0)
208+
return false;
209+
210+
*ret = static_cast<size_t>(tmp_i);
211+
return true;
212+
}
213+
214+
196215
// Buffer methods
197216

198217
bool HasInstance(Local<Value> val) {

src/node_internals.h

-18
Original file line numberDiff line numberDiff line change
@@ -175,24 +175,6 @@ inline bool IsBigEndian() {
175175
return GetEndianness() == kBigEndian;
176176
}
177177

178-
// parse index for external array data
179-
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> arg,
180-
size_t def,
181-
size_t* ret) {
182-
if (arg->IsUndefined()) {
183-
*ret = def;
184-
return true;
185-
}
186-
187-
int64_t tmp_i = arg->IntegerValue();
188-
189-
if (tmp_i < 0)
190-
return false;
191-
192-
*ret = static_cast<size_t>(tmp_i);
193-
return true;
194-
}
195-
196178
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
197179
public:
198180
inline uint32_t* zero_fill_field() { return &zero_fill_field_; }

0 commit comments

Comments
 (0)