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:
@ -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)
|
void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
|
||||||
{
|
{
|
||||||
DilloUrl *action;
|
std::unique_ptr< DilloUrl > action;
|
||||||
DilloHtmlMethod method;
|
DilloHtmlMethod method;
|
||||||
DilloHtmlEnc content_type;
|
DilloHtmlEnc content_type;
|
||||||
char *first;
|
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")))
|
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 {
|
else {
|
||||||
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
|
if (html->DocType != DT_HTML || html->DocTypeVersion <= 4.01f)
|
||||||
BUG_MSG("<form> requires action attribute.");
|
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;
|
content_type = DILLO_HTML_ENC_URLENCODED;
|
||||||
if ((method == DILLO_HTML_METHOD_POST) &&
|
if ((method == DILLO_HTML_METHOD_POST) &&
|
||||||
@ -408,9 +408,8 @@ void Html_tag_open_form(DilloHtml *html, const char *tag, int tagsize)
|
|||||||
}
|
}
|
||||||
if (!charset)
|
if (!charset)
|
||||||
charset = html->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);
|
dFree(first);
|
||||||
delete action;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Html_tag_close_form(DilloHtml *html)
|
void Html_tag_close_form(DilloHtml *html)
|
||||||
|
|||||||
Reference in New Issue
Block a user