@@ -323,7 +323,6 @@ static int update_target(git_refdb *db, transaction_node *node)
323323int git_transaction_commit (git_transaction * tx )
324324{
325325 transaction_node * node ;
326- git_strmap_iter pos ;
327326 int error = 0 ;
328327
329328 assert (tx );
@@ -335,11 +334,7 @@ int git_transaction_commit(git_transaction *tx)
335334 return error ;
336335 }
337336
338- for (pos = kh_begin (tx -> locks ); pos < kh_end (tx -> locks ); pos ++ ) {
339- if (!git_strmap_has_data (tx -> locks , pos ))
340- continue ;
341-
342- node = git_strmap_value_at (tx -> locks , pos );
337+ git_strmap_foreach_value (tx -> locks , node , {
343338 if (node -> reflog ) {
344339 if ((error = tx -> db -> backend -> reflog_write (tx -> db -> backend , node -> reflog )) < 0 )
345340 return error ;
@@ -349,7 +344,7 @@ int git_transaction_commit(git_transaction *tx)
349344 if ((error = update_target (tx -> db , node )) < 0 )
350345 return error ;
351346 }
352- }
347+ });
353348
354349 return 0 ;
355350}
@@ -358,7 +353,6 @@ void git_transaction_free(git_transaction *tx)
358353{
359354 transaction_node * node ;
360355 git_pool pool ;
361- git_strmap_iter pos ;
362356
363357 assert (tx );
364358
@@ -373,16 +367,12 @@ void git_transaction_free(git_transaction *tx)
373367 }
374368
375369 /* start by unlocking the ones we've left hanging, if any */
376- for (pos = kh_begin (tx -> locks ); pos < kh_end (tx -> locks ); pos ++ ) {
377- if (!git_strmap_has_data (tx -> locks , pos ))
378- continue ;
379-
380- node = git_strmap_value_at (tx -> locks , pos );
370+ git_strmap_foreach_value (tx -> locks , node , {
381371 if (node -> committed )
382372 continue ;
383373
384374 git_refdb_unlock (tx -> db , node -> payload , false, false, NULL , NULL , NULL );
385- }
375+ });
386376
387377 git_refdb_free (tx -> db );
388378 git_strmap_free (tx -> locks );
0 commit comments