Logo Search packages:      
Sourcecode: inkscape version File versions

CRStatement* cr_statement_unlink ( CRStatement *  a_stmt  ) 

Unlinks a statement from the statements list.

Parameters:
a_this the current statements list.
a_to_unlink the statement to unlink from the list.
Returns:
the new list where a_to_unlink has been unlinked from, or NULL in case of error.

Some sanity checks first

Now, the real unlinking job.

Definition at line 1800 of file cr-statement.c.

{
        CRStatement *result = a_stmt;

        g_return_val_if_fail (result, NULL);

        /**
         *Some sanity checks first
         */
        if (a_stmt->next) {
                g_return_val_if_fail (a_stmt->next->prev == a_stmt, NULL);
        }
        if (a_stmt->prev) {
                g_return_val_if_fail (a_stmt->prev->next == a_stmt, NULL);
        }

        /**
         *Now, the real unlinking job.
         */
        if (a_stmt->next) {
                a_stmt->next->prev = a_stmt->prev;
        }
        if (a_stmt->prev) {
                a_stmt->prev->next = a_stmt->next;
        }

        if (a_stmt->parent_sheet
            && a_stmt->parent_sheet->statements == a_stmt) {
                a_stmt->parent_sheet->statements =
                        a_stmt->parent_sheet->statements->next;
        }

        a_stmt->next = NULL;
        a_stmt->prev = NULL;
        a_stmt->parent_sheet = NULL;

        return result;
}


Generated by  Doxygen 1.6.0   Back to index