Skip to content

Commit c5fcb1e

Browse files
addaleaxtargos
authored andcommitted
src: remove std::array overload of FIXED_ONE_BYTE_STRING
This overload was only used in one place, in a cold path, and in particular in a place where the compiler would be able to generate the exact same code using just a call to `.size()`. PR-URL: #59826 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Juan José Arboleda <[email protected]> Reviewed-By: Gerhard Stöbich <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent acbb2da commit c5fcb1e

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

src/node_os.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void GetInterfaceAddresses(const FunctionCallbackInfo<Value>& args) {
259259
result.emplace_back(OneByteString(isolate, ip));
260260
result.emplace_back(OneByteString(isolate, netmask));
261261
result.emplace_back(family);
262-
result.emplace_back(FIXED_ONE_BYTE_STRING(isolate, mac));
262+
result.emplace_back(OneByteString(isolate, mac.data(), mac.size() - 1));
263263
result.emplace_back(
264264
Boolean::New(env->isolate(), interfaces[i].is_internal));
265265
if (interfaces[i].address.address4.sin_family == AF_INET6) {

src/util.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,6 @@ inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(v8::Isolate* isolate,
356356
return OneByteString(isolate, data, N - 1);
357357
}
358358

359-
template <std::size_t N>
360-
requires(N > 0)
361-
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
362-
v8::Isolate* isolate, const std::array<char, N>& arr) {
363-
CHECK_EQ(arr[N - 1], '\0');
364-
return OneByteString(isolate, arr.data(), N - 1);
365-
}
366-
367359
// tolower() is locale-sensitive. Use ToLower() instead.
368360
inline char ToLower(char c);
369361
inline std::string ToLower(const std::string& in);

0 commit comments

Comments
 (0)