Skip to content

Commit

Permalink
process: linted code
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Jan 7, 2025
1 parent 5c82dba commit 6fa8a12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace node {
// This forward declaration is to have the method available in error messages.
namespace errors {
const char* errno_string(int errorno);
const char* errno_string(int errorno);
}

enum ErrorHandlingMode { CONTEXTIFY_ERROR, FATAL_ERROR, MODULE_ERROR };
Expand Down
20 changes: 11 additions & 9 deletions src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,9 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
env->Exit(code);
}

inline char** copy_js_strings_array(
Environment* env, Local<Array> js_array, int* target_length) {
inline char** copy_js_strings_array(Environment* env,
Local<Array> js_array,
int* target_length) {
Local<Context> context = env->context();
char** target = nullptr;
int length = js_array->Length();
Expand All @@ -486,8 +487,8 @@ inline char** copy_js_strings_array(

if (length > 0) {
for (int i = 0; i < length; i++) {
node::Utf8Value str(
env->isolate(), js_array->Get(context, i).ToLocalChecked());
node::Utf8Value str(env->isolate(),
js_array->Get(context, i).ToLocalChecked());
target[i] = strdup(*str);
CHECK_NOT_NULL(target[i]);
}
Expand Down Expand Up @@ -529,12 +530,13 @@ static void Replace(const FunctionCallbackInfo<Value>& args) {

Local<Array> argv_array = args[1].As<Array>();

Local<Array> full_argv_array = Array::New(
env->isolate(), argv_array->Length() + 1);
Local<Array> full_argv_array =
Array::New(env->isolate(), argv_array->Length() + 1);
full_argv_array->Set(context, 0, args[0].As<String>()).Check();
for (unsigned int i = 0; i < argv_array->Length(); i++) {
full_argv_array->Set(
context, i + 1, argv_array->Get(context, i).ToLocalChecked()).Check();
full_argv_array
->Set(context, i + 1, argv_array->Get(context, i).ToLocalChecked())
.Check();
}

argv = copy_js_strings_array(env, full_argv_array, nullptr);
Expand All @@ -561,7 +563,7 @@ static void Replace(const FunctionCallbackInfo<Value>& args) {

// Set stdin, stdout and stderr to be non-close-on-exec
// so that the new process will inherit it.
for (int i = 0; i < 3; i ++) {
for (int i = 0; i < 3; i++) {
// Operation failed. Free up memory, then throw.
if (persist_standard_stream(i) < 0) {
int error_code = errno;
Expand Down

0 comments on commit 6fa8a12

Please sign in to comment.