Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0eebf4

Browse filesBrowse files
bnoordhuisMyles Borins
authored andcommitted
src,tools: remove null sentinel from source array
PR-URL: #5418 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
1 parent 8f18414 commit e0eebf4
Copy full SHA for e0eebf4

File tree

Expand file treeCollapse file tree

2 files changed

+6
-17
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-17
lines changed
Open diff view settings
Collapse file

‎src/node_javascript.cc‎

Copy file name to clipboardExpand all lines: src/node_javascript.cc
+5-10Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
#include "env.h"
55
#include "env-inl.h"
66

7-
#include <string.h>
8-
#if !defined(_MSC_VER)
9-
#include <strings.h>
10-
#endif
11-
127
namespace node {
138

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

29-
for (int i = 0; natives[i].name; i++) {
30-
if (natives[i].source != node_native) {
31-
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name);
24+
for (auto native : natives) {
25+
if (native.source != node_native) {
26+
Local<String> name = String::NewFromUtf8(env->isolate(), native.name);
3227
Local<String> source =
3328
String::NewFromUtf8(
34-
env->isolate(), reinterpret_cast<const char*>(natives[i].source),
35-
NewStringType::kNormal, natives[i].source_len).ToLocalChecked();
29+
env->isolate(), reinterpret_cast<const char*>(native.source),
30+
NewStringType::kNormal, native.source_len).ToLocalChecked();
3631
target->Set(name, source);
3732
}
3833
}
Collapse file

‎tools/js2c.py‎

Copy file name to clipboardExpand all lines: tools/js2c.py
+1-7Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,13 +207,7 @@ def ReadMacros(lines):
207207
size_t source_len;
208208
};
209209
210-
static const struct _native natives[] = {
211-
212-
%(native_lines)s\
213-
214-
{ NULL, NULL, 0 } /* sentinel */
215-
216-
};
210+
static const struct _native natives[] = { %(native_lines)s };
217211
218212
}
219213
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.