From a41395475492a635ffe4e80aeb237cd575f27663 Mon Sep 17 00:00:00 2001 From: tpoisseau <22891227+tpoisseau@users.noreply.github.com> Date: Sat, 24 Aug 2024 18:01:09 +0200 Subject: [PATCH] chore: switch to snake_case Refs: https://github.com/nodejs/node/pull/54213#discussion_r1729017525 --- src/node_sqlite.cc | 55 ++++++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/src/node_sqlite.cc b/src/node_sqlite.cc index 592b17ed8bdec4..5901e7d6ba54d7 100644 --- a/src/node_sqlite.cc +++ b/src/node_sqlite.cc @@ -520,9 +520,9 @@ void StatementSync::IterateReturnCallback( auto context = env->context(); Local data = Local::Cast(args.Data()); - IterateCaptureContext* captureContext = + IterateCaptureContext* capture_context = static_cast(data->Value()); - auto stmt = captureContext->stmt; + auto stmt = capture_context->stmt; sqlite3_reset(stmt->statement_); Local result = Object::New(isolate); @@ -546,10 +546,10 @@ void StatementSync::IterateNextCallback( auto context = env->context(); Local data = Local::Cast(args.Data()); - IterateCaptureContext* captureContext = + IterateCaptureContext* capture_context = static_cast(data->Value()); - auto stmt = captureContext->stmt; - auto num_cols = captureContext->num_cols; + auto stmt = capture_context->stmt; + auto num_cols = capture_context->num_cols; int r = sqlite3_step(stmt->statement_); if (r != SQLITE_ROW) { @@ -613,45 +613,48 @@ void StatementSync::Iterate(const FunctionCallbackInfo& args) { return; } - Local iterableIteratorTemplate = ObjectTemplate::New(isolate); + Local iterable_iterator_template = + ObjectTemplate::New(isolate); - IterateCaptureContext* captureContext = new IterateCaptureContext(); - captureContext->num_cols = sqlite3_column_count(stmt->statement_); - captureContext->stmt = stmt; - Local nextFuncTemplate = + IterateCaptureContext* capture_context = new IterateCaptureContext(); + capture_context->num_cols = sqlite3_column_count(stmt->statement_); + capture_context->stmt = stmt; + Local next_func_template = FunctionTemplate::New(isolate, StatementSync::IterateNextCallback, - External::New(isolate, captureContext)); - Local returnFuncTemplate = + External::New(isolate, capture_context)); + Local return_func_template = FunctionTemplate::New(isolate, StatementSync::IterateReturnCallback, - External::New(isolate, captureContext)); + External::New(isolate, capture_context)); - iterableIteratorTemplate->Set(String::NewFromUtf8Literal(isolate, "next"), - nextFuncTemplate); - iterableIteratorTemplate->Set(String::NewFromUtf8Literal(isolate, "return"), - returnFuncTemplate); + iterable_iterator_template->Set(String::NewFromUtf8Literal(isolate, "next"), + next_func_template); + iterable_iterator_template->Set(String::NewFromUtf8Literal(isolate, "return"), + return_func_template); - Local iterableIterator = - iterableIteratorTemplate->NewInstance(context).ToLocalChecked(); + Local iterable_iterator = + iterable_iterator_template->NewInstance(context).ToLocalChecked(); Local global = context->Global(); - Local globalThis = + Local js_global_this = global->Get(context, String::NewFromUtf8Literal(isolate, "globalThis")) .ToLocalChecked() .As(); - Local JSIterator = - globalThis->Get(context, String::NewFromUtf8Literal(isolate, "Iterator")) + Local js_iterator = + js_global_this + ->Get(context, String::NewFromUtf8Literal(isolate, "Iterator")) .ToLocalChecked() .As(); - Local JSIteratorPrototype = - JSIterator->Get(context, String::NewFromUtf8Literal(isolate, "prototype")) + Local js_iterator_prototype = + js_iterator + ->Get(context, String::NewFromUtf8Literal(isolate, "prototype")) .ToLocalChecked() .As(); - iterableIterator->SetPrototype(context, JSIteratorPrototype).ToChecked(); + iterable_iterator->SetPrototype(context, js_iterator_prototype).ToChecked(); - args.GetReturnValue().Set(iterableIterator); + args.GetReturnValue().Set(iterable_iterator); } void StatementSync::Get(const FunctionCallbackInfo& args) {