@@ -1035,8 +1035,10 @@ static void pmb_advance_or_null_multi_match(struct diff_options *o,
10351035{
10361036 int i ;
10371037 char * got_match = xcalloc (1 , pmb_nr );
1038+ struct hashmap_entry * ent ;
10381039
1039- for (; match ; match = hashmap_get_next (hm , & match -> ent )) {
1040+ for (ent = & match -> ent ; ent ; ent = hashmap_get_next (hm , ent )) {
1041+ match = container_of (ent , struct moved_entry , ent );
10401042 for (i = 0 ; i < pmb_nr ; i ++ ) {
10411043 struct moved_entry * prev = pmb [i ].match ;
10421044 struct moved_entry * cur = (prev && prev -> next_line ) ?
@@ -1135,29 +1137,30 @@ static void mark_color_as_moved(struct diff_options *o,
11351137
11361138 for (n = 0 ; n < o -> emitted_symbols -> nr ; n ++ ) {
11371139 struct hashmap * hm = NULL ;
1140+ struct hashmap_entry * ent = NULL ;
11381141 struct moved_entry * key ;
1139- struct moved_entry * match = NULL ;
1142+ struct moved_entry * match ;
11401143 struct emitted_diff_symbol * l = & o -> emitted_symbols -> buf [n ];
11411144 enum diff_symbol last_symbol = 0 ;
11421145
11431146 switch (l -> s ) {
11441147 case DIFF_SYMBOL_PLUS :
11451148 hm = del_lines ;
11461149 key = prepare_entry (o , n );
1147- match = hashmap_get (hm , & key -> ent , NULL );
1150+ ent = hashmap_get (hm , & key -> ent , NULL );
11481151 free (key );
11491152 break ;
11501153 case DIFF_SYMBOL_MINUS :
11511154 hm = add_lines ;
11521155 key = prepare_entry (o , n );
1153- match = hashmap_get (hm , & key -> ent , NULL );
1156+ ent = hashmap_get (hm , & key -> ent , NULL );
11541157 free (key );
11551158 break ;
11561159 default :
11571160 flipped_block = 0 ;
11581161 }
11591162
1160- if (!match ) {
1163+ if (!ent ) {
11611164 int i ;
11621165
11631166 adjust_last_block (o , n , block_length );
@@ -1169,6 +1172,7 @@ static void mark_color_as_moved(struct diff_options *o,
11691172 last_symbol = l -> s ;
11701173 continue ;
11711174 }
1175+ match = container_of (ent , struct moved_entry , ent );
11721176
11731177 if (o -> color_moved == COLOR_MOVED_PLAIN ) {
11741178 last_symbol = l -> s ;
@@ -1189,8 +1193,9 @@ static void mark_color_as_moved(struct diff_options *o,
11891193 * The current line is the start of a new block.
11901194 * Setup the set of potential blocks.
11911195 */
1192- for (; match ; match = hashmap_get_next (hm ,
1193- & match -> ent )) {
1196+ for (; ent ; ent = hashmap_get_next (hm , ent )) {
1197+ match = container_of (ent , struct moved_entry ,
1198+ ent );
11941199 ALLOC_GROW (pmb , pmb_nr + 1 , pmb_alloc );
11951200 if (o -> color_moved_ws_handling &
11961201 COLOR_MOVED_WS_ALLOW_INDENTATION_CHANGE ) {
0 commit comments