GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: create strings in `FIXED_ONE_BYTE_STRING` as internalized · nodejs/node@34dcb7d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • util-inl.h
    • util.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/util-inl.h‎

Copy file name to clipboardExpand all lines: src/util-inl.h
+16-15Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -159,33 +159,34 @@ constexpr ContainerOfHelper<Inner, Outer> ContainerOf(Inner Outer::*field,
159159

160160
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
161161
const char* data,
162-
int length) {
163-
return v8::String::NewFromOneByte(isolate,
164-
reinterpret_cast<const uint8_t*>(data),
165-
v8::NewStringType::kNormal,
166-
length).ToLocalChecked();
162+
int length,
163+
v8::NewStringType type) {
164+
return v8::String::NewFromOneByte(
165+
isolate, reinterpret_cast<const uint8_t*>(data), type, length)
166+
.ToLocalChecked();
167167
}
168168

169169
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
170170
const signed char* data,
171-
int length) {
172-
return v8::String::NewFromOneByte(isolate,
173-
reinterpret_cast<const uint8_t*>(data),
174-
v8::NewStringType::kNormal,
175-
length).ToLocalChecked();
171+
int length,
172+
v8::NewStringType type) {
173+
return v8::String::NewFromOneByte(
174+
isolate, reinterpret_cast<const uint8_t*>(data), type, length)
175+
.ToLocalChecked();
176176
}
177177

178178
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
179179
const unsigned char* data,
180-
int length) {
181-
return v8::String::NewFromOneByte(
182-
isolate, data, v8::NewStringType::kNormal, length)
180+
int length,
181+
v8::NewStringType type) {
182+
return v8::String::NewFromOneByte(isolate, data, type, length)
183183
.ToLocalChecked();
184184
}
185185

186186
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
187-
std::string_view str) {
188-
return OneByteString(isolate, str.data(), str.size());
187+
std::string_view str,
188+
v8::NewStringType type) {
189+
return OneByteString(isolate, str.data(), str.size(), type);
189190
}
190191

191192
char ToLower(char c) {
Collapse file

‎src/util.h‎

Copy file name to clipboardExpand all lines: src/util.h
+20-12Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -330,29 +330,37 @@ class KVStore {
330330
};
331331

332332
// Convenience wrapper around v8::String::NewFromOneByte().
333-
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
334-
const char* data,
335-
int length = -1);
333+
inline v8::Local<v8::String> OneByteString(
334+
v8::Isolate* isolate,
335+
const char* data,
336+
int length = -1,
337+
v8::NewStringType type = v8::NewStringType::kNormal);
336338

337339
// For the people that compile with -funsigned-char.
338-
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
339-
const signed char* data,
340-
int length = -1);
340+
inline v8::Local<v8::String> OneByteString(
341+
v8::Isolate* isolate,
342+
const signed char* data,
343+
int length = -1,
344+
v8::NewStringType type = v8::NewStringType::kNormal);
341345

342-
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
343-
const unsigned char* data,
344-
int length = -1);
346+
inline v8::Local<v8::String> OneByteString(
347+
v8::Isolate* isolate,
348+
const unsigned char* data,
349+
int length = -1,
350+
v8::NewStringType type = v8::NewStringType::kNormal);
345351

346-
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
347-
std::string_view str);
352+
inline v8::Local<v8::String> OneByteString(
353+
v8::Isolate* isolate,
354+
std::string_view str,
355+
v8::NewStringType type = v8::NewStringType::kNormal);
348356

349357
// Used to be a macro, hence the uppercase name.
350358
template <std::size_t N>
351359
requires(N > 0)
352360
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(v8::Isolate* isolate,
353361
const char (&data)[N]) {
354362
CHECK_EQ(data[N - 1], '\0');
355-
return OneByteString(isolate, data, N - 1);
363+
return OneByteString(isolate, data, N - 1, v8::NewStringType::kInternalized);
356364
}
357365

358366
// tolower() is locale-sensitive. Use ToLower() instead.

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.