perf: use v8::String::NewFromUtf8Literal in ToV8() gin converter (#44517)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-11-01 16:56:23 -05:00 committed by GitHub
parent 5498eaa29d
commit fe27901d31
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -70,12 +70,10 @@ struct Converter<char[]> {
}
};
template <size_t n>
struct Converter<char[n]> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const char* val) {
return v8::String::NewFromUtf8(isolate, val, v8::NewStringType::kNormal,
n - 1)
.ToLocalChecked();
template <size_t N>
struct Converter<char[N]> {
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate, const char (&val)[N]) {
return v8::String::NewFromUtf8Literal(isolate, val);
}
};