Ownership issues
At the moment ownership aspects are completely undocumented, so I looked into the code:
-
url->hrefis a non-owning a shallow copy of the parameter given tourl_parse()and not touched by the remaining code at all. - all other members of
struct url_dataare each heap-allocated copies, owned by the struct (and thereforefree()'d inurl_free()).
I'd like to know which property/behavior is as desired, which is just by coincidence and might be changed in a more optimized implementation (which I already have in mind, e.g. to support key-value access to the content of the query string, incl. percent decoding of non-ASCII data etc.) Different ownership would not affect clients/users that use the data read-only, but clients that changes the member would break.
@RokerHRO I think if you have some good ideas about memory ownership, feel free to express them in a PR! I am highly confident it will be merged in :)
@RokerHRO I think if you have some good ideas about memory ownership, feel free to express them in a PR! I am highly confident it will be merged in :)
I got some ideas and working on it. :-)