Skip to content

Commit ae70e2b

Browse files
committed
src: general C++ cleanup in node_url.cc
- Merge `domain` and `opaque` storage in URL parser: This just simplifies the code a bit, having multiple fields in an union with the same type is usually just overhead. - Add move variant of `URLHost::ToString()`: This helps avoid unnecessary string copy operations, especially since we control the lifetime of `URLHost` objects pretty well. - Use const refs in node_url.cc where appropriate - Remove or reduce overly generous `.reserve()` calls: These would otherwise keep a lot of unused memory lying around. - Return return values instead of unnecessary pointer arguments - Use more common/expressive variable names - Avoid macro use, reduce number of unnecessary JS strings: There’s no reason for `GET`, `GET_AND_SET` and `UTF8STRING` to be macros. Also, `GET` would previously create a JS string instance for each single call, even though the strings it was called with were compile-time constants. - Avoid unnecessary JS casts when the type of a value is known - Avoid (commonly unnecessary) copy for whitespace stripping PR-URL: #19598 Reviewed-By: Tiancheng "Timothy" Gu <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent b7cfd27 commit ae70e2b

File tree

2 files changed

+192
-151
lines changed

2 files changed

+192
-151
lines changed

src/env.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,13 @@ struct PackageConfig {
165165
V(fingerprint_string, "fingerprint") \
166166
V(fingerprint256_string, "fingerprint256") \
167167
V(flags_string, "flags") \
168+
V(fragment_string, "fragment") \
168169
V(get_data_clone_error_string, "_getDataCloneError") \
169170
V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId") \
170171
V(gid_string, "gid") \
171172
V(handle_string, "handle") \
172173
V(homedir_string, "homedir") \
174+
V(host_string, "host") \
173175
V(hostmaster_string, "hostmaster") \
174176
V(ignore_string, "ignore") \
175177
V(infoaccess_string, "infoAccess") \
@@ -226,6 +228,7 @@ struct PackageConfig {
226228
V(order_string, "order") \
227229
V(owner_string, "owner") \
228230
V(parse_error_string, "Parse Error") \
231+
V(password_string, "password") \
229232
V(path_string, "path") \
230233
V(pending_handle_string, "pendingHandle") \
231234
V(pbkdf2_error_string, "PBKDF2 Error") \
@@ -239,6 +242,7 @@ struct PackageConfig {
239242
V(produce_cached_data_string, "produceCachedData") \
240243
V(promise_string, "promise") \
241244
V(pubkey_string, "pubkey") \
245+
V(query_string, "query") \
242246
V(raw_string, "raw") \
243247
V(read_host_object_string, "_readHostObject") \
244248
V(readable_string, "readable") \
@@ -247,6 +251,7 @@ struct PackageConfig {
247251
V(rename_string, "rename") \
248252
V(replacement_string, "replacement") \
249253
V(retry_string, "retry") \
254+
V(scheme_string, "scheme") \
250255
V(serial_string, "serial") \
251256
V(scopeid_string, "scopeid") \
252257
V(serial_number_string, "serialNumber") \

0 commit comments

Comments
 (0)