Skip to content

Commit 9e2edd6

Browse files
rscharfegitster
authored andcommitted
graph: use SWAP macro
Exchange the values of graph->columns and graph->new_columns using the macro SWAP instead of hand-rolled code. The result is shorter and easier to read. This transformation was not done by the semantic patch swap.cocci because there's an unrelated statement between the second and the last step of the exchange, so it didn't match the expected pattern. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 402bf8e commit 9e2edd6

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

graph.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ static void graph_update_width(struct git_graph *graph,
463463
static void graph_update_columns(struct git_graph *graph)
464464
{
465465
struct commit_list *parent;
466-
struct column *tmp_columns;
467466
int max_new_columns;
468467
int mapping_idx;
469468
int i, seen_this, is_commit_in_columns;
@@ -476,11 +475,8 @@ static void graph_update_columns(struct git_graph *graph)
476475
* We'll re-use the old columns array as storage to compute the new
477476
* columns list for the commit after this one.
478477
*/
479-
tmp_columns = graph->columns;
480-
graph->columns = graph->new_columns;
478+
SWAP(graph->columns, graph->new_columns);
481479
graph->num_columns = graph->num_new_columns;
482-
483-
graph->new_columns = tmp_columns;
484480
graph->num_new_columns = 0;
485481

486482
/*

0 commit comments

Comments
 (0)