Skip to content

Commit c730a5d

Browse files
bnoordhuiscjihrig
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]> Conflicts: src/node_internals.h
1 parent da9bd2f commit c730a5d

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/node_buffer.cc

Lines changed: 19 additions & 0 deletions
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

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -176,24 +176,6 @@ inline bool IsBigEndian() {
176176
return GetEndianness() == kBigEndian;
177177
}
178178

179-
// parse index for external array data
180-
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> arg,
181-
size_t def,
182-
size_t* ret) {
183-
if (arg->IsUndefined()) {
184-
*ret = def;
185-
return true;
186-
}
187-
188-
int64_t tmp_i = arg->IntegerValue();
189-
190-
if (tmp_i < 0)
191-
return false;
192-
193-
*ret = static_cast<size_t>(tmp_i);
194-
return true;
195-
}
196-
197179
void ThrowError(v8::Isolate* isolate, const char* errmsg);
198180
void ThrowTypeError(v8::Isolate* isolate, const char* errmsg);
199181
void ThrowRangeError(v8::Isolate* isolate, const char* errmsg);

0 commit comments

Comments
 (0)