| 1015 | } |
| 1016 | |
| 1017 | static LIST * apply_modifiers_non_empty( LIST * result, string * buf, |
| 1018 | VAR_EDITS * edits, int n, LISTITER begin, LISTITER end ) |
| 1019 | { |
| 1020 | int i; |
| 1021 | LISTITER iter; |
| 1022 | for ( i = 0; i < n; ++i ) |
| 1023 | { |
| 1024 | if ( edits[ i ].join.ptr ) |
| 1025 | { |
| 1026 | var_edit_file( object_str( list_item( begin ) ), buf, edits + i ); |
| 1027 | var_edit_shift( buf, 0, edits + i ); |
| 1028 | for ( iter = list_next( begin ); iter != end; iter = list_next( iter |
| 1029 | ) ) |
| 1030 | { |
| 1031 | size_t size; |
| 1032 | string_append( buf, edits[ i ].join.ptr ); |
| 1033 | size = buf->size; |
| 1034 | var_edit_file( object_str( list_item( iter ) ), buf, edits + i |
| 1035 | ); |
| 1036 | var_edit_shift( buf, size, edits + i ); |
| 1037 | } |
| 1038 | result = list_push_back( result, object_new( buf->value ) ); |
| 1039 | string_truncate( buf, 0 ); |
| 1040 | } |
| 1041 | else |
| 1042 | { |
| 1043 | for ( iter = begin; iter != end; iter = list_next( iter ) ) |
| 1044 | { |
| 1045 | var_edit_file( object_str( list_item( iter ) ), buf, edits + i ); |
| 1046 | var_edit_shift( buf, 0, edits + i ); |
| 1047 | result = list_push_back( result, object_new( buf->value ) ); |
| 1048 | string_truncate( buf, 0 ); |
| 1049 | } |
| 1050 | } |
| 1051 | } |
| 1052 | return result; |
| 1053 | } |
| 1054 | |
| 1055 | static LIST * apply_modifiers_impl( LIST * result, string * buf, |
| 1056 | VAR_EDITS * edits, int n, LISTITER iter, LISTITER end ) |
no test coverage detected