summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@gnome.org>2004-02-14 13:53:49 +0000
committerDodji Seketeli <dodji@src.gnome.org>2004-02-14 13:53:49 +0000
commit5c693b892418b7b0603037cc508dc8e313ce0046 (patch)
treef8eb2b4558e5c3d8c23e61cfa3449060968a3070
parentcb6a50718eeb9ea9ad59fbbd793c44d9d4519860 (diff)
downloadlibcroco-5c693b892418b7b0603037cc508dc8e313ce0046.tar.gz
applied a patch from Rob BUIS<rwlbuis@xs4all.nl> that does a bunch of
2004-02-14 Dodji Seketeli <dodji@gnome.org> * src/cr-declaration.[ch]: applied a patch from Rob BUIS<rwlbuis@xs4all.nl> that does a bunch of cleanup and fixes. It also adds the new cr_declaration_list_to_string() api entry point. * AUTHORS: updated this
-rw-r--r--AUTHORS12
-rw-r--r--ChangeLog8
-rw-r--r--src/cr-declaration.c48
-rw-r--r--src/cr-declaration.h3
4 files changed, 63 insertions, 8 deletions
diff --git a/AUTHORS b/AUTHORS
index 9fb45ba..75562c3 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,7 +1,13 @@
-Dodji Seketeli <dodji@seketeli.org>
-###################################
+Dodji Seketeli <dodji@gnome.org>
+-----------------------------------
Initial Author, main maintainer and main architect.
-Gael Chamoulaud <strider@freespiders.org>
+Gael Chamoulaud <strider@gnome.org>
##########################################
Programmer.
+
+Rob BUIS <rwlbuis@xs4all.nl>
+----------------------------
+Sent several patches.
+
+
diff --git a/ChangeLog b/ChangeLog
index 1b5a973..320b56b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2004-02-14 Dodji Seketeli <dodji@gnome.org>
+ * src/cr-declaration.[ch]: applied a patch from
+ Rob BUIS<rwlbuis@xs4all.nl> that does a bunch of cleanup and
+ fixes. It also adds the new cr_declaration_list_to_string() api
+ entry point.
+ * AUTHORS: updated this
+
+2004-02-14 Dodji Seketeli <dodji@gnome.org>
+
* src/cr-declaration.[ch]:
(cr_declaration_nr_props),
(cr_declaration_get_from_list),
diff --git a/src/cr-declaration.c b/src/cr-declaration.c
index 925e758..d1b99d0 100644
--- a/src/cr-declaration.c
+++ b/src/cr-declaration.c
@@ -603,17 +603,55 @@ cr_declaration_to_string (CRDeclaration *a_this,
}
/**
+ *Serializes the declaration list into a string
+ *@param a_this the current instance of #CRDeclaration.
+ *@param a_indent the number of indentation white char
+ *to put before the actual serialisation.
+ */
+guchar *
+cr_declaration_list_to_string (CRDeclaration *a_this,
+ gulong a_indent)
+{
+ CRDeclaration *cur = NULL ;
+ GString *stringue = NULL ;
+ guchar *str = NULL, *result = NULL ;
+
+ g_return_val_if_fail (a_this, NULL) ;
+
+ stringue = g_string_new (NULL) ;
+
+ for (cur = a_this ; cur ; cur = cur->next)
+ {
+ str = cr_declaration_to_string (cur, a_indent) ;
+ if (str)
+ {
+ g_string_append_printf (stringue, "%s;", str) ;
+ g_free (str) ;
+ }
+ else
+ break;
+ }
+ if (stringue && stringue->str)
+ {
+ result = stringue->str ;
+ g_string_free (stringue, FALSE) ;
+ }
+
+ return result ;
+}
+
+/**
*Return the number of properties in the declaration;
*@param a_this the current instance of #CRDeclaration.
*@return number of properties in the declaration list.
*/
-int
+gint
cr_declaration_nr_props (CRDeclaration *a_this)
{
CRDeclaration *cur = NULL ;
int nr = 0;
- g_return_if_fail (a_this) ;
+ g_return_val_if_fail (a_this, -1) ;
for (cur = a_this ; cur ; cur = cur->next)
nr ++;
@@ -633,7 +671,7 @@ cr_declaration_get_from_list (CRDeclaration *a_this, int itemnr)
CRDeclaration *cur = NULL ;
int nr = 0;
- g_return_if_fail (a_this) ;
+ g_return_val_if_fail (a_this, NULL) ;
for (cur = a_this ; cur ; cur = cur->next)
if (nr++ == itemnr)
@@ -652,8 +690,8 @@ cr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_prop)
{
CRDeclaration *cur = NULL ;
- g_return_if_fail (a_this) ;
- g_return_if_fail (a_prop) ;
+ g_return_val_if_fail (a_this, NULL) ;
+ g_return_val_if_fail (a_prop, NULL) ;
for (cur = a_this ; cur ; cur = cur->next)
if (!strcmp (cur->property->str, a_prop))
diff --git a/src/cr-declaration.h b/src/cr-declaration.h
index a423495..c065dac 100644
--- a/src/cr-declaration.h
+++ b/src/cr-declaration.h
@@ -112,6 +112,9 @@ cr_declaration_get_by_prop_name (CRDeclaration *a_this, const guchar *a_str) ;
guchar *
cr_declaration_to_string (CRDeclaration *a_this,
gulong a_indent) ;
+guchar *
+cr_declaration_list_to_string (CRDeclaration *a_this,
+ gulong a_indent) ;
void
cr_declaration_ref (CRDeclaration *a_this) ;