summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@src.gnome.org>2003-06-08 14:32:06 +0000
committerDodji Seketeli <dodji@src.gnome.org>2003-06-08 14:32:06 +0000
commit269fa26e3274b94427877ac8fa1ca3d5a5120ed9 (patch)
tree74c83369abcab5d4a287300834ec4d6e667c6850
parent68c69198fac3f17204bac75133135456ab8bcf87 (diff)
downloadlibcroco-269fa26e3274b94427877ac8fa1ca3d5a5120ed9.tar.gz
fixed a memory management bug.
Dodji.
-rw-r--r--src/parser/cr-tknzr.c6
-rw-r--r--tests/test7-main.c235
2 files changed, 86 insertions, 155 deletions
diff --git a/src/parser/cr-tknzr.c b/src/parser/cr-tknzr.c
index e077869..a56e94a 100644
--- a/src/parser/cr-tknzr.c
+++ b/src/parser/cr-tknzr.c
@@ -1091,7 +1091,7 @@ cr_tknzr_parse_name (CRTknzr *a_this, GString **a_str)
if (str_needs_free == TRUE && *a_str)
{
- g_free (*a_str) ;
+ g_string_free (*a_str, TRUE) ;
*a_str= NULL ;
}
@@ -1144,7 +1144,7 @@ cr_tknzr_parse_hash (CRTknzr *a_this, GString **a_str)
if (str_needs_free == TRUE && *a_str)
{
- g_free (*a_str) ;
+ g_string_free (*a_str, TRUE) ;
*a_str = NULL ;
}
@@ -1509,7 +1509,7 @@ cr_tknzr_parse_atkeyword (CRTknzr *a_this, GString **a_str)
if (str_needs_free == TRUE && *a_str)
{
- g_free (*a_str) ;
+ g_string_free (*a_str, TRUE) ;
*a_str = NULL ;
}
diff --git a/tests/test7-main.c b/tests/test7-main.c
index 24d1e1c..5bc4d84 100644
--- a/tests/test7-main.c
+++ b/tests/test7-main.c
@@ -30,173 +30,104 @@
#include "libcroco.h"
#include "cr-test-utils.h"
-/*
-const guchar *gv_xmlbuf =
-"<ARTICLE>"
-" <HEADLINE>Fredrick the Great meets Bach</HEADLINE>"
-" <AUTHOR>Johann Nikolaus Forkel</AUTHOR>"
-" <PARA>"
-" One evening, just as he was getting his"
-" <INSTRUMENT>flute</INSTRUMENT> ready and his"
-" musicians were assembled, an officer brought him a list of"
-" the strangers who had arrived."
-" </PARA>"
-"</ARTICLE>"
-*/
-;
-
-/*
-const guchar *gv_xmlbuf =
-"<ARTICLE>"
-" <HEADLINE>This is a first headline</HEADLINE>"
-" <PARA>A paragraph</PARA>"
-" <AUTHOR>Author: Dodji</AUTHOR>"
-" <HEADLINE>This is another headline</HEADLINE>"
-" <PARA>A second paragraph</PARA>"
-" <AUTHOR>Author: Dodji.</AUTHOR>"
-"</ARTICLE>"
-;
-
-const guchar *gv_cssbuf =
-"INSTRUMENT { display: inline}"
-"ARTICLE, HEADLINE, AUTHOR, PARA"
-"{"
-" display: block ;"
-" position: static; "
-"}"
-
-"ARTICLE"
-"{"
-" background-color: white;"
-"}"
-
-"HEADLINE"
-"{"
-" background-color: blue;"
-" border: solid black thin;"
-"}"
-
-"PARA"
-"{"
-" background-color: pink;"
-" margin-left: 20px; "
-"}"
-;
-*/
const guchar *gv_xmlbuf =
"<?xml version=\"1.0\"?>"
"<rss version=\"0.91\">"
-" <channel>"
-" <title>scottandrew.com JavaScript and DHTML Channel</title>"
+"<channel>"
+"<title>scottandrew.com JavaScript and DHTML Channel</title>"
"<link>http://www.scottandrew.com</link>"
"<description>DHTML, DOM and JavaScript snippets from scottandrew.com</description>"
-" <language>en-us</language>"
-" <item>"
-" <title>DHTML Animation Array Generator</title>"
+"<language>en-us</language>"
+"<item>"
+"<title>DHTML Animation Array Generator</title>"
"<description>Robert points us to the first third-party tool for the DomAPI: The Animation Array Generator, a visual tool for creating...</description>"
"<link>http://www.scottandrew.com/weblog/2002_06#a000395</link>"
-" </item>"
-" <item>"
-" <title>DOM and Extended Entries</title>"
+"</item>"
+"<item>"
+"<title>DOM and Extended Entries</title>"
"<description>Aarondot: A Better Way To Display Extended Entries. Very cool, and uses the DOM and JavaScript to reveal the extended...</description>"
"<link>http://www.scottandrew.com/weblog/2002_06#a000373</link>"
-" </item>"
-" <item>"
-" <title>cellspacing and the DOM</title>"
+"</item>"
+"<item>"
+"<title>cellspacing and the DOM</title>"
"<description>By the way, if you're using the DOM to generate TABLE elements, you have to use setAttribute() to set the...</description>"
-" <link>http://www.scottandrew.com/weblog/2002_05#a000365</link>"
-" </item>"
-" <item>"
-" <title>contenteditable for Mozilla</title>"
-" <description>The folks art Q42, creator of Quek (cute little avatar/chat) and Xopus (browser-based WYSIWYG XML-editor) have released code that simulates...</description>"
-" <link>http://www.scottandrew.com/weblog/2002_05#a000361</link>"
-" </item>"
-" </channel>"
+"<link>http://www.scottandrew.com/weblog/2002_05#a000365</link>"
+"</item>"
+"<item>"
+"<title>contenteditable for Mozilla</title>"
+"<description>The folks art Q42, creator of Quek (cute little avatar/chat) and Xopus (browser-based WYSIWYG XML-editor) have released code that ,simulates...</description>"
+"<link>http://www.scottandrew.com/weblog/2002_05#a000361</link>"
+"</item>"
+"</channel>"
"</rss>"
;
const char * gv_cssbuf=
-"rss"
-"{ "
-" display:block; "
-" margin:10px; "
-"} "
-" "
-"channel "
-"{ "
-" display:block; "
-" /*height:300px;*/ "
-" width:200px; "
-" border:1px solid #000; "
-" overflow:auto; "
-" background-color:#eee; "
-" font: 12px verdana; "
-"} "
-" "
-"item "
-"{ "
-" display: block; "
-" padding:10px; "
-" margin-bottom:10px; "
-" border:1px solid #ccc; "
-" /*border-top:1px solid #c"
-" border-bottom:1px solid #"
-" border-left:1px solid #cc"
-" border-right:1px solid #c"
-" */ "
-" background-color:#fff; "
-"} "
-" "
-" "
-"channel>title, channel>des"
-"{ "
-" display: block; "
-" margin-left:10px; "
-" margin-top:10px; "
-" background-color:#"
-" font-weight:bold; "
-"} "
-" "
-"channel>title "
-"{ "
-" font-size:16px; "
-"} "
-" "
-"channel>description "
-"{ "
-" display: block ; "
-" font-size:10px; "
-" margin-bottom:10px"
-"} "
-" "
-"item>title "
-"{ "
-" font-weight:bold; "
-"} "
-" "
-"item>link, channel>link, "
-"{ "
-" display: none; "
-"} "
-;
-
-/*
-" margin-top: 10px ;"
-" margin-left: 10px ;"
-" margin-bottom: 15px ;"
-" margin-right: 15px ;"
-" border-top-width: thick ;"
-" border-top-style: solid ;"
-" border-right-width: thin ;"
-" border-right-style: solid ;"
-" border-bottom-width: thin ;"
-" border-bottom-style: solid ;"
-" border-left-width: thick ;"
-" border-left-style: solid ;"
-*/
-
-
+"rss "
+"{ "
+" display:block; "
+" margin:10px; "
+"} "
+" "
+"channel "
+"{ "
+" display:block; "
+" /*height:300px;*/ "
+" width:200px; "
+" border:1px solid #000; "
+" overflow:auto; "
+" background-color:#eee; "
+" font: 12px verdana; "
+"} "
+" "
+"item "
+"{ "
+" display: block; "
+" padding:10px; "
+" margin-bottom:10px; "
+" border:1px solid #ccc; "
+" /*border-top:1px solid #ccc; "
+" border-bottom:1px solid #ccc; "
+" border-left:1px solid #ccc; "
+" border-right:1px solid #ccc; "
+" */ "
+" background-color:#fff; "
+"} "
+" "
+" "
+"channel>title, channel>description "
+"{ "
+" display: block; "
+" margin-left:10px; "
+" margin-top:10px; "
+" background-color:#eee; "
+" font-weight:bold; "
+"} "
+" "
+"channel>title "
+"{ "
+" font-size:16px; "
+"} "
+" "
+"channel>description "
+"{ "
+" display: block ; "
+" font-size:10px; "
+" margin-bottom:10px; "
+"} "
+" "
+"item>title "
+"{ "
+" font-weight:bold; "
+"} "
+" "
+"item>link, channel>link, channel>language "
+"{ "
+" display: none; "
+"} "
+" "
+;
static enum CRStatus
test_layout_box (void) ;