GeezerVison is showing github.com — src,tools: remove null sentinel from source array · nodejs/node@e0eebf4
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_javascript.cc +5-10Lines changed: 5 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
4 | 4 | #include "env.h" |
5 | 5 | #include "env-inl.h" |
6 | 6 |
|
7 | | -#include <string.h> |
8 | | -#if !defined(_MSC_VER) |
9 | | -#include <strings.h> |
10 | | -#endif |
11 | | - |
12 | 7 | namespace node { |
13 | 8 |
|
14 | 9 | using v8::HandleScope; |
@@ -26,13 +21,13 @@ Local<String> MainSource(Environment* env) { |
26 | 21 | void DefineJavaScript(Environment* env, Local<Object> target) { |
27 | 22 | HandleScope scope(env->isolate()); |
28 | 23 |
|
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); |
32 | 27 | Local<String> source = |
33 | 28 | 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(); |
36 | 31 | target->Set(name, source); |
37 | 32 | } |
38 | 33 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: tools/js2c.py +1-7Lines changed: 1 addition & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -207,13 +207,7 @@ def ReadMacros(lines): |
207 | 207 | size_t source_len; |
208 | 208 | }; |
209 | 209 |
|
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 }; |
217 | 211 |
|
218 | 212 | } |
219 | 213 | #endif |
|