From 0dc0938c7f2a3aaf302ff6411c816f5e83ddfc52ae98e09afeeb03f81154794c Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 19 Apr 2025 02:41:03 -0400 Subject: [PATCH] This should be a unique_ptr. The lower functions already created them so, and I marked them `release`. Time to unify. --- src/form.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/form.cc b/src/form.cc index 13e2b0b..912534d 100644 --- a/src/form.cc +++ b/src/form.cc @@ -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("
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)