diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-26 22:46:07 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-01-26 22:46:07 +0100 |
commit | 8d23bb6e0bf9bc32d9be7f92df4abdb68e3a7c70 (patch) | |
tree | ccf3104d5faf1978f7b046668257e65884a0f605 | |
parent | 307159fdc7edda9d12a174ebc7d3e0e5480aed4f (diff) |
don't strdup() text passed to ListItem::initWithText()
Memory allocation for text is done within Textblock itself
(noticed by Jeremy).
-rw-r--r-- | dw/listitem.cc | 2 | ||||
-rw-r--r-- | dw/listitem.hh | 2 | ||||
-rw-r--r-- | src/html.cc | 2 | ||||
-rw-r--r-- | test/dw_lists.cc | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/dw/listitem.cc b/dw/listitem.cc index ba960b46..c31690a5 100644 --- a/dw/listitem.cc +++ b/dw/listitem.cc @@ -46,7 +46,7 @@ void ListItem::initWithWidget (core::Widget *widget, updateValue (); } -void ListItem::initWithText (char *text, core::style::Style *style) +void ListItem::initWithText (const char *text, core::style::Style *style) { addText (text, style); addSpace (style); diff --git a/dw/listitem.hh b/dw/listitem.hh index ea24af3e..2e303d5d 100644 --- a/dw/listitem.hh +++ b/dw/listitem.hh @@ -19,7 +19,7 @@ public: ~ListItem(); void initWithWidget (core::Widget *widget, core::style::Style *style); - void initWithText (char *texty, core::style::Style *style); + void initWithText (const char *text, core::style::Style *style); }; } // namespace dw diff --git a/src/html.cc b/src/html.cc index a371c621..f5c10e33 100644 --- a/src/html.cc +++ b/src/html.cc @@ -2566,7 +2566,7 @@ static void Html_tag_open_li(DilloHtml *html, const char *tag, int tagsize) *list_number = 0; } numtostr((*list_number)++, buf, 16, style->listStyleType); - list_item->initWithText (dStrdup(buf), wordStyle); + list_item->initWithText (buf, wordStyle); list_item->addSpace (wordStyle); html->PrevWasSPC = true; } else { diff --git a/test/dw_lists.cc b/test/dw_lists.cc index 2d546f63..5558afa1 100644 --- a/test/dw_lists.cc +++ b/test/dw_lists.cc @@ -109,7 +109,7 @@ int main(int argc, char **argv) char buf[16]; sprintf (buf, "%d.", i); - listItem->initWithText (strdup (buf), wordStyle); + listItem->initWithText (buf, wordStyle); for(int j = 0; wordsItem[j]; j++) { if(j != 0) |