DilloURL has a dtor.

It is the same as the original free function.  But this
will let me put some ownership on various members and slowly
start to C++ify this core type.
This commit is contained in:
2025-04-12 04:08:14 -04:00
parent 07485c7959
commit 441a04609b
21 changed files with 84 additions and 85 deletions

View File

@ -205,17 +205,14 @@ static DilloUrl *Url_object_new(const char *uri_str)
* Free a DilloUrl.
* Do nothing if the argument is NULL
*/
void a_Url_free(DilloUrl *url)
DilloUrl::~DilloUrl()
{
if (url) {
if (url->url_string)
dStr_free(url->url_string, TRUE);
if (url->hostname != url->authority)
dFree((char *)url->hostname);
dFree((char *)url->buffer);
dStr_free(url->data, 1);
dFree(url);
}
if (this->url_string)
dStr_free(this->url_string, TRUE);
if (this->hostname != this->authority)
dFree((char *)this->hostname);
dFree((char *)this->buffer);
dStr_free(this->data, 1);
}
/**
@ -341,8 +338,8 @@ static Dstr *Url_resolve_relative(const char *RelStr,
done:
dStr_free(Path, TRUE);
a_Url_free(RelUrl);
a_Url_free(BaseUrl);
delete RelUrl;
delete BaseUrl;
return SolvedUrl;
}