diff options
author | jcid <devnull@localhost> | 2008-03-16 14:55:08 +0100 |
---|---|---|
committer | jcid <devnull@localhost> | 2008-03-16 14:55:08 +0100 |
commit | 4c5da9f0e04becb56a7397c3eb5ed035060efe37 (patch) | |
tree | ffb2bd937deef3f931506ddf69db024fe8209c92 | |
parent | afd3c602b52e770a2576ecdc615f2927caf885dd (diff) |
- Removed tag_name from the navigation stack (Tags[tag_idx] server the same).
-rw-r--r-- | src/html.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/html.cc b/src/html.cc index 29c9f6c4..4b9db50b 100644 --- a/src/html.cc +++ b/src/html.cc @@ -194,7 +194,6 @@ struct _DilloLinkImage { }; struct _DilloHtmlState { - char *tag_name; dw::core::style::Style *style, *table_cell_style; DilloHtmlParseMode parse_mode; DilloHtmlTableMode table_mode; @@ -818,7 +817,6 @@ DilloHtml::DilloHtml(BrowserWindow *p_bw, const DilloUrl *url, stack = new misc::SimpleVector <DilloHtmlState> (16); stack->increase(); - stack->getRef(0)->tag_name = dStrdup("none"); stack->getRef(0)->style = NULL; stack->getRef(0)->table_cell_style = NULL; stack->getRef(0)->parse_mode = DILLO_HTML_PARSE_MODE_INIT; @@ -1017,7 +1015,6 @@ void DilloHtml::closeParser(int ClientKey) Html_tag_cleanup_at_close(this, stack->getRef(si)->tag_idx); } } - dFree(stack->getRef(0)->tag_name); /* "none" */ (stack->getRef(0)->style)->unref (); /* template style */ delete (stack); @@ -1599,18 +1596,13 @@ static void Html_eventually_pop_dw(DilloHtml *html, bool_t hand_over_break) */ static void Html_push_tag(DilloHtml *html, int tag_idx) { - char *tagstr; int n_items; - /* Save the element's name (no parameters) into tagstr. */ - tagstr = dStrdup(Tags[tag_idx].name); - n_items = html->stack->size (); html->stack->increase (); /* We'll copy the former stack item and just change the tag and its index * instead of copying all fields except for tag. --Jcid */ *html->stack->getRef(n_items) = *html->stack->getRef(n_items - 1); - html->stack->getRef(n_items)->tag_name = tagstr; html->stack->getRef(n_items)->tag_idx = tag_idx; /* proper memory management, may be unref'd later */ (S_TOP(html)->style)->ref (); @@ -1638,7 +1630,6 @@ static void Html_real_pop_tag(DilloHtml *html) (S_TOP(html)->style)->unref (); if (S_TOP(html)->table_cell_style) (S_TOP(html)->table_cell_style)->unref (); - dFree(S_TOP(html)->tag_name); hand_over_break = S_TOP(html)->hand_over_break; html->stack->setSize (html->stack->size() - 1); Html_eventually_pop_dw(html, hand_over_break); @@ -1701,8 +1692,13 @@ static void Html_tag_cleanup_at_close(DilloHtml *html, int TagIdx) } } else { - MSG_HTML("unexpected closing tag: </%s>. -- expected </%s>\n", - Tags[new_idx].name, html->stack->getRef(stack_idx)->tag_name); + if (stack_idx == 0) { + MSG_HTML("unexpected closing tag: </%s>.\n", Tags[new_idx].name); + } else { + MSG_HTML("unexpected closing tag: </%s>. -- expected </%s>\n", + Tags[new_idx].name, + Tags[html->stack->getRef(stack_idx)->tag_idx].name); + } } } @@ -5585,7 +5581,7 @@ static int Html_write_raw(DilloHtml *html, char *buf, int bufsize, int Eof) DILLO_HTML_PARSE_MODE_VERBATIM) { /* Non HTML code here, let's skip until closing tag */ do { - char *tag = S_TOP(html)->tag_name; + const char *tag = Tags[S_TOP(html)->tag_idx].name; buf_index += strcspn(buf + buf_index, "<"); if (buf_index + (int)strlen(tag) + 3 > bufsize) { buf_index = bufsize; |