From e0eebf412ee65cd1114b03c959565dd0759b4a29 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 24 Feb 2016 22:05:00 +0100 Subject: [PATCH] src,tools: remove null sentinel from source array PR-URL: https://github.com/nodejs/node/pull/5418 Reviewed-By: Trevor Norris --- src/node_javascript.cc | 15 +++++---------- tools/js2c.py | 8 +------- 2 files changed, 6 insertions(+), 17 deletions(-) diff --git a/src/node_javascript.cc b/src/node_javascript.cc index 5ba6e1d0a276f3..d5377047c0ec5c 100644 --- a/src/node_javascript.cc +++ b/src/node_javascript.cc @@ -4,11 +4,6 @@ #include "env.h" #include "env-inl.h" -#include -#if !defined(_MSC_VER) -#include -#endif - namespace node { using v8::HandleScope; @@ -26,13 +21,13 @@ Local MainSource(Environment* env) { void DefineJavaScript(Environment* env, Local target) { HandleScope scope(env->isolate()); - for (int i = 0; natives[i].name; i++) { - if (natives[i].source != node_native) { - Local name = String::NewFromUtf8(env->isolate(), natives[i].name); + for (auto native : natives) { + if (native.source != node_native) { + Local name = String::NewFromUtf8(env->isolate(), native.name); Local source = String::NewFromUtf8( - env->isolate(), reinterpret_cast(natives[i].source), - NewStringType::kNormal, natives[i].source_len).ToLocalChecked(); + env->isolate(), reinterpret_cast(native.source), + NewStringType::kNormal, native.source_len).ToLocalChecked(); target->Set(name, source); } } diff --git a/tools/js2c.py b/tools/js2c.py index 761e80be59f76e..3e9a1c39cc496f 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -207,13 +207,7 @@ def ReadMacros(lines): size_t source_len; }; -static const struct _native natives[] = { - -%(native_lines)s\ - - { NULL, NULL, 0 } /* sentinel */ - -}; +static const struct _native natives[] = { %(native_lines)s }; } #endif