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: use String::WriteV2() in TwoByteValue · nodejs/node@9ca4b46

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • util.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/util.cc‎

Copy file name to clipboardExpand all lines: src/util.cc
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,10 @@ TwoByteValue::TwoByteValue(Isolate* isolate, Local<Value> value) {
146146
Local<String> string;
147147
if (!value->ToString(isolate->GetCurrentContext()).ToLocal(&string)) return;
148148

149-
// Allocate enough space to include the null terminator
150-
const size_t storage = string->Length() + 1;
151-
AllocateSufficientStorage(storage);
152-
153-
const int flags = String::NO_NULL_TERMINATION;
154-
const int length = string->Write(isolate, out(), 0, storage, flags);
149+
// Allocate enough space to include the null terminator.
150+
const size_t length = string->Length();
151+
AllocateSufficientStorage(length + 1);
152+
string->WriteV2(isolate, 0, length, out());
155153
SetLengthAndZeroTerminate(length);
156154
}
157155

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.