]> granicus.if.org Git - php/commitdiff
fix C89 compat
authorAnatol Belski <ab@php.net>
Tue, 19 Mar 2013 14:13:27 +0000 (15:13 +0100)
committerAnatol Belski <ab@php.net>
Tue, 19 Mar 2013 14:13:27 +0000 (15:13 +0100)
ext/spl/spl_dllist.c

index 3ac22010fced2c21dbde4fe81b6c502834ee1c9e..83610863e42a3355672e45fd6164f375b2e3a217 100644 (file)
@@ -1260,12 +1260,12 @@ SPL_METHOD(SplDoublyLinkedList, add)
                /* If index is the last entry+1 then we do a push because we're not inserting before any entry */
                spl_ptr_llist_push(intern->llist, value TSRMLS_CC);
        } else {
-               /* Get the element we want to insert before */
-               element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
-
                /* Create the new element we want to insert */
                spl_ptr_llist_element *elem = emalloc(sizeof(spl_ptr_llist_element));
 
+               /* Get the element we want to insert before */
+               element = spl_ptr_llist_offset(intern->llist, index, intern->flags & SPL_DLLIST_IT_LIFO);
+
                elem->data = value;
                elem->rc   = 1;
                /* connect to the neighbours */