| 804 | */ |
| 805 | |
| 806 | static int expand_modifiers( STACK * s, int n ) |
| 807 | { |
| 808 | int i; |
| 809 | int total = 1; |
| 810 | LIST * * args = stack_get( s ); |
| 811 | for ( i = 0; i < n; ++i ) |
| 812 | total *= list_length( args[ i ] ); |
| 813 | |
| 814 | if ( total != 0 ) |
| 815 | { |
| 816 | VAR_EDITS * out = stack_allocate( s, total * sizeof( VAR_EDITS ) ); |
| 817 | LISTITER * iter = stack_allocate( s, n * sizeof( LIST * ) ); |
| 818 | for ( i = 0; i < n; ++i ) |
| 819 | iter[ i ] = list_begin( args[ i ] ); |
| 820 | i = 0; |
| 821 | { |
| 822 | int havezeroed; |
| 823 | loop: |
| 824 | memset( out, 0, sizeof( *out ) ); |
| 825 | havezeroed = 0; |
| 826 | for ( i = 0; i < n; ++i ) |
| 827 | havezeroed = var_edit_parse( object_str( list_item( iter[ i ] ) |
| 828 | ), out, havezeroed ); |
| 829 | ++out; |
| 830 | while ( --i >= 0 ) |
| 831 | { |
| 832 | if ( list_next( iter[ i ] ) != list_end( args[ i ] ) ) |
| 833 | { |
| 834 | iter[ i ] = list_next( iter[ i ] ); |
| 835 | goto loop; |
| 836 | } |
| 837 | iter[ i ] = list_begin( args[ i ] ); |
| 838 | } |
| 839 | } |
| 840 | stack_deallocate( s, n * sizeof( LIST * ) ); |
| 841 | } |
| 842 | return total; |
| 843 | } |
| 844 | |
| 845 | static LIST * apply_modifiers( STACK * s, int n ) |
| 846 | { |
no test coverage detected