Merge branch 'rs/swap'

Code clean-up.

* rs/swap:
  graph: use SWAP macro
  diff: use SWAP macro
  use SWAP macro
  apply: use SWAP macro
  add SWAP macro
This commit is contained in:
Junio C Hamano
2017-02-15 12:54:19 -08:00
14 changed files with 63 additions and 65 deletions

11
graph.c
View File

@ -497,7 +497,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;
@ -510,11 +509,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;
/*
@ -1031,7 +1027,6 @@ static void graph_output_post_merge_line(struct git_graph *graph, struct strbuf
static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf *sb)
{
int i;
int *tmp_mapping;
short used_horizontal = 0;
int horizontal_edge = -1;
int horizontal_edge_target = -1;
@ -1166,9 +1161,7 @@ static void graph_output_collapsing_line(struct git_graph *graph, struct strbuf
/*
* Swap mapping and new_mapping
*/
tmp_mapping = graph->mapping;
graph->mapping = graph->new_mapping;
graph->new_mapping = tmp_mapping;
SWAP(graph->mapping, graph->new_mapping);
/*
* If graph->mapping indicates that all of the branch lines