Skip to content

Commit 01e3190

Browse files
addaleaxtargos
authored andcommitted
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 9f20534 commit 01e3190

File tree

2 files changed

+192
-151
lines changed

2 files changed

+192
-151
lines changed

src/env.h

+5
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,13 @@ struct PackageConfig {
170170
V(fingerprint_string, "fingerprint") \
171171
V(fingerprint256_string, "fingerprint256") \
172172
V(flags_string, "flags") \
173+
V(fragment_string, "fragment") \
173174
V(get_data_clone_error_string, "_getDataCloneError") \
174175
V(get_shared_array_buffer_id_string, "_getSharedArrayBufferId") \
175176
V(gid_string, "gid") \
176177
V(handle_string, "handle") \
177178
V(homedir_string, "homedir") \
179+
V(host_string, "host") \
178180
V(hostmaster_string, "hostmaster") \
179181
V(ignore_string, "ignore") \
180182
V(infoaccess_string, "infoAccess") \
@@ -232,6 +234,7 @@ struct PackageConfig {
232234
V(order_string, "order") \
233235
V(owner_string, "owner") \
234236
V(parse_error_string, "Parse Error") \
237+
V(password_string, "password") \
235238
V(path_string, "path") \
236239
V(pending_handle_string, "pendingHandle") \
237240
V(pbkdf2_error_string, "PBKDF2 Error") \
@@ -242,6 +245,7 @@ struct PackageConfig {
242245
V(priority_string, "priority") \
243246
V(produce_cached_data_string, "produceCachedData") \
244247
V(pubkey_string, "pubkey") \
248+
V(query_string, "query") \
245249
V(raw_string, "raw") \
246250
V(read_host_object_string, "_readHostObject") \
247251
V(readable_string, "readable") \
@@ -251,6 +255,7 @@ struct PackageConfig {
251255
V(rename_string, "rename") \
252256
V(replacement_string, "replacement") \
253257
V(retry_string, "retry") \
258+
V(scheme_string, "scheme") \
254259
V(serial_string, "serial") \
255260
V(scopeid_string, "scopeid") \
256261
V(sent_shutdown_string, "sentShutdown") \

0 commit comments

Comments
 (0)