summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2017-01-28 21:42:15 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-01-30 22:23:12 (GMT)
commit9e2edd66dda418dad751d5eb2e5921e05e57cd30 (patch)
tree4c81efb368f0fa60a228f64300901cf1ca67e82c /graph.c
parent402bf8e19832142de97d84d37c51262d91e5f2db (diff)
downloadgit-9e2edd66dda418dad751d5eb2e5921e05e57cd30.zip
git-9e2edd66dda418dad751d5eb2e5921e05e57cd30.tar.gz
git-9e2edd66dda418dad751d5eb2e5921e05e57cd30.tar.bz2
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>
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/graph.c b/graph.c
index 4c72230..29b0f51 100644
--- a/graph.c
+++ b/graph.c
@@ -463,7 +463,6 @@ static void graph_update_width(struct git_graph *graph,
static void graph_update_columns(struct git_graph *graph)
{
struct commit_list *parent;
- struct column *tmp_columns;
int max_new_columns;
int mapping_idx;
int i, seen_this, is_commit_in_columns;
@@ -476,11 +475,8 @@ static void graph_update_columns(struct git_graph *graph)
* We'll re-use the old columns array as storage to compute the new
* columns list for the commit after this one.
*/
- tmp_columns = graph->columns;
- graph->columns = graph->new_columns;
+ SWAP(graph->columns, graph->new_columns);
graph->num_columns = graph->num_new_columns;
-
- graph->new_columns = tmp_columns;
graph->num_new_columns = 0;
/*