[Mesa-dev] exec_list question

Ian Romanick idr at freedesktop.org
Sun Jan 12 13:09:15 PST 2014


I think you should use move_nodes_to to move all the nodes from one to
the other, pop_head to remove the head, then push_head to put it back on
the original list.  There's probably a more clever way, but it may not
be worth the effort to figure it out.

On 01/12/2014 12:08 AM, Timothy Arceri wrote:
> Hi Guys,
> 
> I've been chasing my tail most of the afternoon using exec_list
> basically I was just trying to copy all but the first element from one
> list to another using the code bellow. 
> 
>             exec_list *copy_dims =
> &type->array_specifier->array_dimensions;
>             int i = 0;
>             //TODO: has to be better way to copy all dimension but the
> first one
>             foreach_list (node, copy_dims) {
>                if(i>0)
>                   array_specifier->array_dimensions.push_tail(node);
>                i++;
>             }
> 
> But when doing this the last element from the list I was coping FROM was
> somehow being lost.
> 
> Replacing foreach_list with foreach_list_safe seems to have fixed the
> problem. However I don't really understand why is someone able to
> explain to me what's happening here?
> 
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 



More information about the mesa-dev mailing list