| 845 | */ |
| 846 | |
| 847 | static int expand_modifiers( STACK * s, int n ) |
| 848 | { |
| 849 | int i; |
| 850 | int total = 1; |
| 851 | LIST * * args = stack_get( s ); |
| 852 | for ( i = 0; i < n; ++i ) |
| 853 | total *= list_length( args[ i ] ); |
| 854 | |
| 855 | if ( total != 0 ) |
| 856 | { |
| 857 | VAR_EDITS * out = stack_allocate( s, total * sizeof( VAR_EDITS ) ); |
| 858 | LISTITER * iter = stack_allocate( s, n * sizeof( LIST * ) ); |
| 859 | for ( i = 0; i < n; ++i ) |
| 860 | iter[ i ] = list_begin( args[ i ] ); |
| 861 | i = 0; |
| 862 | { |
| 863 | int havezeroed; |
| 864 | loop: |
| 865 | memset( out, 0, sizeof( *out ) ); |
| 866 | havezeroed = 0; |
| 867 | for ( i = 0; i < n; ++i ) |
| 868 | havezeroed = var_edit_parse( object_str( list_item( iter[ i ] ) |
| 869 | ), out, havezeroed ); |
| 870 | ++out; |
| 871 | while ( --i >= 0 ) |
| 872 | { |
| 873 | if ( list_next( iter[ i ] ) != list_end( args[ i ] ) ) |
| 874 | { |
| 875 | iter[ i ] = list_next( iter[ i ] ); |
| 876 | goto loop; |
| 877 | } |
| 878 | iter[ i ] = list_begin( args[ i ] ); |
| 879 | } |
| 880 | } |
| 881 | stack_deallocate( s, n * sizeof( LIST * ) ); |
| 882 | } |
| 883 | return total; |
| 884 | } |
| 885 | |
| 886 | static LIST * apply_modifiers( STACK * s, int n ) |
| 887 | { |
no test coverage detected