diff --git a/src/html.cc b/src/html.cc
index 901284e..a57a1c6 100644
--- a/src/html.cc
+++ b/src/html.cc
@@ -239,8 +239,8 @@ void a_Html_load_images(void *v_html, DilloUrl *pattern)
*/
static bool Html_contains_form(DilloHtml *html, void *v_form)
{
- for (int i = 0; i < html->forms->size(); i++) {
- if (html->forms->get(i) == v_form) {
+ for (std::size_t i = 0; i < html->forms.size(); i++) {
+ if (html->forms.at(i) == v_form) {
return true;
}
}
@@ -504,7 +504,7 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url,
visited_color = -1;
/* Init page-handling variables */
- forms = new misc::SimpleVector (1);
+ forms.reserve(1);
inputs_outside_form = new misc::SimpleVector (1);
links.reserve(64);
images = new misc::SimpleVector (16);
@@ -547,9 +547,9 @@ DilloHtml::~DilloHtml()
a_Url_free(cssUrls->get(i));
delete (cssUrls);
- for (int i = 0; i < forms->size(); i++)
- a_Html_form_delete (forms->get(i));
- delete(forms);
+ for (std::size_t i = 0; i < forms.size(); i++)
+ a_Html_form_delete (forms.at(i));
+ forms.clear();
for (int i = 0; i < inputs_outside_form->size(); i++)
a_Html_input_delete(inputs_outside_form->get(i));
@@ -673,11 +673,11 @@ int DilloHtml::formNew(DilloHtmlMethod method, const DilloUrl *action,
bool enabled = bw->NumPendingStyleSheets == 0;
DilloHtmlForm *form = a_Html_form_new (this, method, action,
enc, charset, enabled);
- int nf = forms->size ();
- forms->increase ();
- forms->set (nf, form);
+ int nf = forms.size ();
+ (void) nf;
+ forms.emplace_back (form);
_MSG("Html formNew: action=%s nform=%d\n", action, nf);
- return forms->size();
+ return forms.size();
}
/**
@@ -685,7 +685,7 @@ int DilloHtml::formNew(DilloHtmlMethod method, const DilloUrl *action,
*/
DilloHtmlForm *DilloHtml::getCurrentForm ()
{
- return forms->get (forms->size() - 1);
+ return forms.back();
}
bool_t DilloHtml::unloadedImages()
diff --git a/src/html_common.hh b/src/html_common.hh
index 9a43e65..a586562 100644
--- a/src/html_common.hh
+++ b/src/html_common.hh
@@ -213,7 +213,7 @@ public: //BUG: for now everything is public
/* -------------------------------------------------------------------*/
/* Variables required after parsing (for page functionality) */
/* -------------------------------------------------------------------*/
- lout::misc::SimpleVector *forms;
+ std::vector< DilloHtmlForm * > forms;
lout::misc::SimpleVector *inputs_outside_form;
std::vector< std::unique_ptr< DilloUrl > > links;
lout::misc::SimpleVector *images;