src,tools: remove null sentinel from source array

PR-URL: https://github.com/nodejs/node/pull/5418
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
Ben Noordhuis 2016-02-24 22:05:00 +01:00
parent 96adbe9503
commit 33e51fe18c
2 changed files with 6 additions and 17 deletions

View File

@ -4,11 +4,6 @@
#include "env.h" #include "env.h"
#include "env-inl.h" #include "env-inl.h"
#include <string.h>
#if !defined(_MSC_VER)
#include <strings.h>
#endif
namespace node { namespace node {
using v8::HandleScope; using v8::HandleScope;
@ -26,13 +21,13 @@ Local<String> MainSource(Environment* env) {
void DefineJavaScript(Environment* env, Local<Object> target) { void DefineJavaScript(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
for (int i = 0; natives[i].name; i++) { for (auto native : natives) {
if (natives[i].source != node_native) { if (native.source != node_native) {
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name); Local<String> name = String::NewFromUtf8(env->isolate(), native.name);
Local<String> source = Local<String> source =
String::NewFromUtf8( String::NewFromUtf8(
env->isolate(), reinterpret_cast<const char*>(natives[i].source), env->isolate(), reinterpret_cast<const char*>(native.source),
NewStringType::kNormal, natives[i].source_len).ToLocalChecked(); NewStringType::kNormal, native.source_len).ToLocalChecked();
target->Set(name, source); target->Set(name, source);
} }
} }

View File

@ -207,13 +207,7 @@ struct _native {
size_t source_len; size_t source_len;
}; };
static const struct _native natives[] = { static const struct _native natives[] = { %(native_lines)s };
%(native_lines)s\
{ NULL, NULL, 0 } /* sentinel */
};
} }
#endif #endif