]> wimlib.net Git - wimlib/commitdiff
xml.c: Simplify node_get_string()
authorEric Biggers <ebiggers3@gmail.com>
Sat, 6 Sep 2014 03:26:03 +0000 (22:26 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Sat, 6 Sep 2014 03:28:06 +0000 (22:28 -0500)
src/xml.c

index 5351c2c29af190abafac32adcab216cfc73777f4..dc910f3758ed2a63bfce64eb7cb166ca8f0d80ae 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -272,21 +272,13 @@ static int
 node_get_string(const xmlNode *string_node, tchar **tstr_ret)
 {
        xmlNode *child;
-       tchar *tstr = NULL;
-       int ret;
 
        if (*tstr_ret)
                return 0;
 
-       for_node_child(string_node, child) {
-               if (node_is_text(child) && child->content) {
-                       ret = utf8_to_tstr_simple(child->content, &tstr);
-                       if (ret)
-                               return ret;
-                       break;
-               }
-       }
-       *tstr_ret = tstr;
+       for_node_child(string_node, child)
+               if (node_is_text(child) && child->content)
+                       return utf8_to_tstr_simple(child->content, tstr_ret);
        return 0;
 }