Logo Search packages:      
Sourcecode: inkscape version File versions

void cr_declaration_destroy ( CRDeclaration a_this  ) 

Destructor of the declaration list.

Parameters:
a_this the current instance of CRDeclaration.

Definition at line 715 of file cr-declaration.c.

References cr_term_destroy().

Referenced by cr_declaration_parse_list_from_buf(), cr_declaration_unref(), cr_statement_ruleset_set_decl_list(), and sp_style_merge_from_style_string().

{
        CRDeclaration *cur = NULL;

        g_return_if_fail (a_this);

        /*
         *Go get the tail of the list.
         *Meanwhile, free each property/value pair contained in the list.
         */
        for (cur = a_this; cur && cur->next; cur = cur->next) {
                if (cur->property) {
                        cr_string_destroy (cur->property);
                        cur->property = NULL;
                }

                if (cur->value) {
                        cr_term_destroy (cur->value);
                        cur->value = NULL;
                }
        }

        if (cur) {
                if (cur->property) {
                        cr_string_destroy (cur->property);
                        cur->property = NULL;
                }

                if (cur->value) {
                        cr_term_destroy (cur->value);
                        cur->value = NULL;
                }
        }

        /*in case the list contains only one element */
        if (cur && !cur->prev) {
                g_free (cur);
                return;
        }

        /*walk backward the list and free each "next" element */
        for (cur = cur->prev; cur && cur->prev; cur = cur->prev) {
                if (cur->next) {
                        g_free (cur->next);
                        cur->next = NULL;
                }
        }

        if (!cur)
                return;

        if (cur->next) {
                g_free (cur->next);
                cur->next = NULL;
        }

        g_free (cur);
}


Generated by  Doxygen 1.6.0   Back to index