From ca6cfe359fa55a5a7f4b6ae73500ffd98e6ee968 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 18 Nov 2024 01:17:24 -0800 Subject: URL refactor part 1. This eliminates most (but not all) of the dynamic allocations associated with URL objects. A number of convenience fields on the URL are removed, but we are able to use common buffer for most of the details. --- include/nng/nng.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/nng/nng.h b/include/nng/nng.h index 984f67d4..47260b8d 100644 --- a/include/nng/nng.h +++ b/include/nng/nng.h @@ -1085,14 +1085,16 @@ enum nng_errno_enum { typedef struct nng_url { char *u_rawurl; // never NULL const char *u_scheme; // never NULL - char *u_userinfo; // will be NULL if not specified - char *u_host; // including colon and port + const char *u_userinfo; // will be NULL if not specified char *u_hostname; // name only, will be "" if not specified uint16_t u_port; // port, may be zero for schemes that do not use char *u_path; // path, will be "" if not specified char *u_query; // without '?', will be NULL if not specified char *u_fragment; // without '#', will be NULL if not specified - char *u_requri; // includes query and fragment, "" if not specified + // these members are private + char *u_buffer; + size_t u_bufsz; + char u_static[NNG_MAXADDRLEN]; // Most URLs fit within this } nng_url; // nng_url_parse parses a URL string into a structured form. -- cgit v1.2.3-70-g09d2