[balsa] address-book-rubrica: Drop redundant NULL checks
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] address-book-rubrica: Drop redundant NULL checks
- Date: Tue, 4 Jun 2019 16:18:51 +0000 (UTC)
commit 132a3db85929462a0d1aaedbe2a6a41f68438c14
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Tue Jun 4 12:14:57 2019 -0400
address-book-rubrica: Drop redundant NULL checks
Because g_strdup(NULL) is NULL.
libbalsa/address-book-rubrica.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
---
diff --git a/libbalsa/address-book-rubrica.c b/libbalsa/address-book-rubrica.c
index 123f7194d..46e79ed2a 100644
--- a/libbalsa/address-book-rubrica.c
+++ b/libbalsa/address-book-rubrica.c
@@ -716,8 +716,8 @@ static gchar *
xml_node_get_text(xmlNodePtr node)
{
g_return_val_if_fail(node != NULL, NULL);
- if ((node = node->children) && node->type == XML_TEXT_NODE
- && node->content)
+
+ if ((node = node->children) != NULL && node->type == XML_TEXT_NODE)
return g_strdup((const gchar *) node->content);
else
return NULL;
@@ -730,15 +730,12 @@ xml_node_get_attr(xmlNodePtr node, const xmlChar * attname)
xmlAttrPtr props;
g_return_val_if_fail(node != NULL, NULL);
- props = node->properties;
- while (props) {
+
+ for (props = node->properties; props != NULL; props = props->next) {
if (props->type == XML_ATTRIBUTE_NODE
&& !xmlStrcmp(props->name, attname) && props->children
&& props->children->type == XML_TEXT_NODE)
- return props->children->
- content ? g_strdup((const gchar *) props->children->
- content) : NULL;
- props = props->next;
+ return g_strdup((const gchar *) props->children->content);
}
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]