diff options
author | Timm Bäder <mail@baedert.org> | 2016-07-14 14:22:55 +0200 |
---|---|---|
committer | Timm Bäder <mail@baedert.org> | 2016-07-14 18:30:32 +0200 |
commit | b11a1664cd4dfcc62b07b4a68adc220fd1eb8305 (patch) | |
tree | 3b2bcf53dbc1fd6f9f8c8c25931af45826a50e4b /rest/rest-xml-node.c | |
parent | eb4f757691ccac55daa2e87ff8843a4812004276 (diff) | |
download | librest-b11a1664cd4dfcc62b07b4a68adc220fd1eb8305.tar.gz |
Add more missing precondition checks
Diffstat (limited to 'rest/rest-xml-node.c')
-rw-r--r-- | rest/rest-xml-node.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rest/rest-xml-node.c b/rest/rest-xml-node.c index 1a74bcb..9655dc1 100644 --- a/rest/rest-xml-node.c +++ b/rest/rest-xml-node.c @@ -215,6 +215,8 @@ const gchar * rest_xml_node_get_attr (RestXmlNode *node, const gchar *attr_name) { + g_return_val_if_fail (attr_name != NULL, NULL); + return g_hash_table_lookup (node->attrs, attr_name); } @@ -238,6 +240,7 @@ rest_xml_node_find (RestXmlNode *start, const char *tag_interned; g_return_val_if_fail (start, NULL); + g_return_val_if_fail (tag != NULL, NULL); g_return_val_if_fail (start->ref_count > 0, NULL); tag_interned = g_intern_string (tag); @@ -331,6 +334,7 @@ rest_xml_node_add_child (RestXmlNode *parent, const char *tag) RestXmlNode *node; char *escaped; + g_return_val_if_fail (parent, NULL); g_return_val_if_fail (tag && *tag, NULL); escaped = g_markup_escape_text (tag, -1); @@ -372,7 +376,11 @@ rest_xml_node_add_attr (RestXmlNode *node, const char *attribute, const char *value) { - g_return_if_fail (node && attribute && *attribute); + g_return_if_fail (node); + g_return_if_fail (attribute); + g_return_if_fail (*attribute); + g_return_if_fail (value); + g_return_if_fail (*value); g_hash_table_insert (node->attrs, g_markup_escape_text (attribute, -1), @@ -389,7 +397,9 @@ rest_xml_node_add_attr (RestXmlNode *node, void rest_xml_node_set_content (RestXmlNode *node, const char *value) { - g_return_if_fail (node && value && *value); + g_return_if_fail (node); + g_return_if_fail (value); + g_return_if_fail (*value); g_free (node->content); node->content = g_markup_escape_text (value, -1); |