]> gitweb.michael.orlitzky.com - libsvgtiny.git/commitdiff
Minor tidyup.
authorMichael Drake <tlsa@netsurf-browser.org>
Fri, 23 Aug 2013 09:47:56 +0000 (10:47 +0100)
committerMichael Drake <tlsa@netsurf-browser.org>
Fri, 23 Aug 2013 09:47:56 +0000 (10:47 +0100)
src/svgtiny_gradient.c

index 8103c14454a5dabfab6bd3cc1c434ca9f3ad0f14..6842a0b2c2261fdec388ddb00f5ffd9e361e7871 100644 (file)
@@ -31,7 +31,7 @@ static void svgtiny_invert_matrix(float *m, float *inv);
 void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state)
 {
        dom_element *gradient;
-       dom_string *id_str;
+       dom_string *id_str, *name;
        dom_exception exc;
 
        #ifdef GRADIENT_DEBUG
@@ -59,35 +59,32 @@ void svgtiny_find_gradient(const char *id, struct svgtiny_parse_state *state)
        state->gradient_transform.e = 0;
        state->gradient_transform.f = 0;
        
-       exc = dom_string_create_interned((const uint8_t *) id, strlen(id),
-                                        &id_str);
+       exc = dom_string_create_interned((const uint8_t *) id,
+                       strlen(id), &id_str);
        if (exc != DOM_NO_ERR)
                return;
        
        exc = dom_document_get_element_by_id(state->document, id_str,
                                             &gradient);
        dom_string_unref(id_str);
-       if (exc != DOM_NO_ERR)
-               return;
-
-       if (gradient == NULL) {
+       if (exc != DOM_NO_ERR || gradient == NULL) {
                #ifdef GRADIENT_DEBUG
                fprintf(stderr, "gradient \"%s\" not found\n", id);
                #endif
                return;
        }
        
-       exc = dom_node_get_node_name(gradient, &id_str);
+       exc = dom_node_get_node_name(gradient, &name);
        if (exc != DOM_NO_ERR) {
                dom_node_unref(gradient);
                return;
        }
        
-       if (dom_string_isequal(id_str, state->interned_linearGradient))
+       if (dom_string_isequal(name, state->interned_linearGradient))
                svgtiny_parse_linear_gradient(gradient, state);
        
-       dom_string_unref(id_str);
        dom_node_unref(gradient);
+       dom_string_unref(name);
 
        #ifdef GRADIENT_DEBUG
        fprintf(stderr, "linear_gradient_stop_count %i\n",