aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-04-15 05:09:04 +0800
committerChris Lahey <clahey@src.gnome.org>2000-04-15 05:09:04 +0800
commitb87c37a1e8f6b3091c59a8ee7314c87aec6538c7 (patch)
tree64baabcd2a068e69cdc85eb3fa2a6f57294fb5fb
parent6f7c1a19440f91d05009dbea60518771327b88ff (diff)
downloadgsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar.gz
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar.bz2
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar.lz
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar.xz
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.tar.zst
gsoc2013-evolution-b87c37a1e8f6b3091c59a8ee7314c87aec6538c7.zip
Add g_return_if_fails.
2000-04-14 Christopher James Lahey <clahey@helixcode.com> * e-xml-utils.c: Add g_return_if_fails. svn path=/trunk/; revision=2435
-rw-r--r--e-util/ChangeLog4
-rw-r--r--e-util/e-xml-utils.c19
-rw-r--r--e-util/e-xml-utils.c-5682619
3 files changed, 38 insertions, 4 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 613b1fbc9d..aa2e8baca1 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,7 @@
+2000-04-14 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-xml-utils.c: Add g_return_if_fails.
+
2000-04-12 Miguel de Icaza <miguel@gnu.org>
* e-cursors.c (e_cursor_get): Prevent next hacker to get bitten by this.
diff --git a/e-util/e-xml-utils.c b/e-util/e-xml-utils.c
index db9cfafb92..bfa2b1cb4c 100644
--- a/e-util/e-xml-utils.c
+++ b/e-util/e-xml-utils.c
@@ -26,6 +26,9 @@
xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name)
{
xmlNode *child;
+
+ g_return_val_if_fail(parent != NULL, NULL);
+ g_return_val_if_fail(child_name != NULL, NULL);
for (child = parent->childs; child; child = child->next) {
if ( !xmlStrcmp( child->name, child_name ) ) {
@@ -38,7 +41,12 @@ xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name)
int
e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name)
{
- xmlChar *prop = xmlGetProp(parent, prop_name);
+ xmlChar *prop;
+
+ g_return_val_if_fail (parent != NULL, 0);
+ g_return_val_if_fail (prop_name != NULL, 0);
+
+ prop = xmlGetProp(parent, prop_name);
if (prop)
return atoi(prop);
else
@@ -48,7 +56,14 @@ e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name)
void
e_xml_set_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name, int value)
{
- xmlChar *valuestr = g_strdup_printf("%d", value);
+ xmlChar *valuestr;
+
+ g_return_if_fail (parent != NULL);
+ g_return_val_if_fail (prop_name != NULL, 0);
+
+ valuestr = g_strdup_printf("%d", value);
xmlSetProp(parent, prop_name, valuestr);
g_free (valuestr);
}
+
+
diff --git a/e-util/e-xml-utils.c-56826 b/e-util/e-xml-utils.c-56826
index db9cfafb92..bfa2b1cb4c 100644
--- a/e-util/e-xml-utils.c-56826
+++ b/e-util/e-xml-utils.c-56826
@@ -26,6 +26,9 @@
xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name)
{
xmlNode *child;
+
+ g_return_val_if_fail(parent != NULL, NULL);
+ g_return_val_if_fail(child_name != NULL, NULL);
for (child = parent->childs; child; child = child->next) {
if ( !xmlStrcmp( child->name, child_name ) ) {
@@ -38,7 +41,12 @@ xmlNode *e_xml_get_child_by_name(xmlNode *parent, xmlChar *child_name)
int
e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name)
{
- xmlChar *prop = xmlGetProp(parent, prop_name);
+ xmlChar *prop;
+
+ g_return_val_if_fail (parent != NULL, 0);
+ g_return_val_if_fail (prop_name != NULL, 0);
+
+ prop = xmlGetProp(parent, prop_name);
if (prop)
return atoi(prop);
else
@@ -48,7 +56,14 @@ e_xml_get_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name)
void
e_xml_set_integer_prop_by_name(xmlNode *parent, xmlChar *prop_name, int value)
{
- xmlChar *valuestr = g_strdup_printf("%d", value);
+ xmlChar *valuestr;
+
+ g_return_if_fail (parent != NULL);
+ g_return_val_if_fail (prop_name != NULL, 0);
+
+ valuestr = g_strdup_printf("%d", value);
xmlSetProp(parent, prop_name, valuestr);
g_free (valuestr);
}
+
+