This should be a unique_ptr.

The lower functions already created them so, and I marked them
`release`.  Time to unify.
This commit is contained in:
2025-04-19 02:41:03 -04:00
parent b5b137c2df
commit 0dc0938c7f

View File

@ -351,7 +351,7 @@ static std::shared_ptr< DilloHtmlInput > Html_get_current_input(DilloHtml &html)
*/
void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
{
DilloUrl *action;
std::unique_ptr< DilloUrl > action;
DilloHtmlMethod method;
DilloHtmlEnc content_type;
char *first;
@ -378,11 +378,11 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
}
}
if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "action")))
action = a_Html_url_new(html, attrbuf, NULL, 0).release();
action = a_Html_url_new(html, attrbuf, NULL, 0);
else {
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
BUG_MSG("<form> requires action attribute.");
action = a_Url_dup(html->base_url).release();
action = a_Url_dup(html->base_url);
}
content_type = DILLO_HTML_ENC_URLENCODED;
if ((method == DILLO_HTML_METHOD_POST) &&
@ -408,9 +408,8 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
}
if (!charset)
charset = html->charset;
html->formNew(method, action, content_type, charset.has_value() ? charset.value().c_str() : nullptr );
html->formNew(method, action.get(), content_type, charset.has_value() ? charset.value().c_str() : nullptr );
dFree(first);
delete action;
}
void Html_tag_close_form(DilloHtml *html)