Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
src,tools: remove null sentinel from source array
PR-URL: #5418
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
bnoordhuis committed Feb 25, 2016
commit 33e51fe18c82e882fe65f77ab14cbaf0efee4e0f
15 changes: 5 additions & 10 deletions src/node_javascript.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
#include "env.h"
#include "env-inl.h"

#include <string.h>
#if !defined(_MSC_VER)
#include <strings.h>
#endif

namespace node {

using v8::HandleScope;
Expand All @@ -26,13 +21,13 @@ Local<String> MainSource(Environment* env) {
void DefineJavaScript(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate());

for (int i = 0; natives[i].name; i++) {
if (natives[i].source != node_native) {
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name);
for (auto native : natives) {
if (native.source != node_native) {
Local<String> name = String::NewFromUtf8(env->isolate(), native.name);
Local<String> source =
String::NewFromUtf8(
env->isolate(), reinterpret_cast<const char*>(natives[i].source),
NewStringType::kNormal, natives[i].source_len).ToLocalChecked();
env->isolate(), reinterpret_cast<const char*>(native.source),
NewStringType::kNormal, native.source_len).ToLocalChecked();
target->Set(name, source);
}
}
Expand Down
8 changes: 1 addition & 7 deletions tools/js2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down