Skip to content
  • Kenneth Graunke's avatar
    glsl: Use a new foreach_two_lists macro for walking two lists at once. · 48d0faaa
    Kenneth Graunke authored
    
    
    When handling function calls, we often want to walk through the list of
    formal parameters and list of actual parameters at the same time.
    (Both are guaranteed to be the same length.)
    
    Previously, we used a pattern of:
    
       exec_list_iterator 1st_iter = <1st list>.iterator();
       foreach_iter(exec_list_iterator, 2nd_iter, <2nd list>) {
          ...
          1st_iter.next();
       }
    
    This was awkward, since you had to manually iterate through one of
    the two lists.
    
    This patch introduces a foreach_two_lists macro which safely walks
    through two lists at the same time, so you can simply do:
    
       foreach_two_lists(1st_node, <1st list>, 2nd_node, <2nd list>) {
          ...
       }
    
    v2: Rename macro from foreach_list2 to foreach_two_lists, as suggested
        by Ian Romanick.
    
    Signed-off-by: default avatarKenneth Graunke <kenneth@whitecape.org>
    Reviewed-by: default avatarMatt Turner <mattst88@gmail.com>
    Reviewed-by: default avatarIan Romanick <ian.d.romanick@intel.com>
    48d0faaa