[librsvg: 54/95] node_set_atts(): Remove call to rsvg_property_bag_size()



commit f3edcbd2bad938a779a15e0b5a9d9d8f47db2d23
Author: Federico Mena Quintero <federico gnome org>
Date:   Tue Feb 20 20:25:30 2018 -0600

    node_set_atts(): Remove call to rsvg_property_bag_size()
    
    We tried to avoid looking up a bunch of possibly nonexistent
    attributes; now that we iterate over existing ones, this shouldn't be
    necessary anymore.

 rsvg-base.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/rsvg-base.c b/rsvg-base.c
index 6321e56c..af6fae6d 100644
--- a/rsvg-base.c
+++ b/rsvg-base.c
@@ -390,26 +390,24 @@ get_node_creator_for_element_name (const char *name)
 static void
 node_set_atts (RsvgNode * node, RsvgHandle *handle, const NodeCreator *creator, RsvgPropertyBag atts)
 {
-    if (rsvg_property_bag_size (atts) > 0) {
-        const char *id;
-        const char *klazz;
+    const char *id;
+    const char *klazz;
 
-        rsvg_node_set_atts (node, handle, atts);
+    rsvg_node_set_atts (node, handle, atts);
 
-        /* The "svg" node is special; it will load its id/class
-         * attributes until the end, when rsvg_end_element() calls
-         * _rsvg_node_svg_apply_atts()
-         */
-        if (rsvg_node_get_type (node) != RSVG_NODE_TYPE_SVG) {
-            id = rsvg_property_bag_lookup (atts, "id");
+    /* The "svg" node is special; it will load its id/class
+     * attributes until the end, when rsvg_end_element() calls
+     * _rsvg_node_svg_apply_atts()
+     */
+    if (rsvg_node_get_type (node) != RSVG_NODE_TYPE_SVG) {
+        id = rsvg_property_bag_lookup (atts, "id");
 
-            if (creator->supports_class_attribute)
-                klazz = rsvg_property_bag_lookup (atts, "class");
-            else
-                klazz = NULL;
+        if (creator->supports_class_attribute)
+            klazz = rsvg_property_bag_lookup (atts, "class");
+        else
+            klazz = NULL;
 
-            rsvg_parse_style_attrs (handle, node, creator->element_name, klazz, id, atts);
-        }
+        rsvg_parse_style_attrs (handle, node, creator->element_name, klazz, id, atts);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]