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 — ffi: remove dead null check in callback arguments · nodejs/node@0002f0a

File tree

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

‎src/node_ffi.cc‎

Copy file name to clipboardExpand all lines: src/node_ffi.cc
+4-7Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ using v8::Local;
3232
using v8::LocalVector;
3333
using v8::Maybe;
3434
using v8::MaybeLocal;
35-
using v8::Null;
3635
using v8::Object;
3736
using v8::PropertyAttribute;
3837
using v8::ReadOnly;
@@ -715,13 +714,11 @@ void DynamicLibrary::InvokeCallback(ffi_cif* cif,
715714
size_t expected_args = cb->args.size();
716715
LocalVector<Value> callback_args(isolate, expected_args);
717716

717+
// libffi always points `args[i]` at its own storage for the value of
718+
// argument `i`, so the slot pointers themselves are never null. A NULL
719+
// pointer argument surfaces as the BigInt `0n` via ToJSArgument.
718720
for (size_t i = 0; i < expected_args; i++) {
719-
if (args[i] == nullptr) {
720-
callback_args[i] = Null(isolate);
721-
continue;
722-
} else {
723-
callback_args[i] = ToJSArgument(isolate, cb->args[i], args[i]);
724-
}
721+
callback_args[i] = ToJSArgument(isolate, cb->args[i], args[i]);
725722
}
726723

727724
TryCatch try_catch(isolate);

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.