From: Junio C Hamano Date: Mon, 29 Sep 2014 19:36:11 +0000 (-0700) Subject: Merge branch 'rs/graph-simplify' X-Git-Tag: v2.2.0-rc0~76 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/0a2ba82c76e0c28d58595fbdc2c43120f821b239?ds=inline;hp=-c Merge branch 'rs/graph-simplify' * rs/graph-simplify: graph: simplify graph_padding_line() --- 0a2ba82c76e0c28d58595fbdc2c43120f821b239 diff --combined graph.c index 23fff73e18,52605e4f6b..c25a09a8fd --- a/graph.c +++ b/graph.c @@@ -267,10 -267,16 +267,10 @@@ static void graph_ensure_capacity(struc graph->column_capacity *= 2; } while (graph->column_capacity < num_columns); - graph->columns = xrealloc(graph->columns, - sizeof(struct column) * - graph->column_capacity); - graph->new_columns = xrealloc(graph->new_columns, - sizeof(struct column) * - graph->column_capacity); - graph->mapping = xrealloc(graph->mapping, - sizeof(int) * 2 * graph->column_capacity); - graph->new_mapping = xrealloc(graph->new_mapping, - sizeof(int) * 2 * graph->column_capacity); + REALLOC_ARRAY(graph->columns, graph->column_capacity); + REALLOC_ARRAY(graph->new_columns, graph->column_capacity); + REALLOC_ARRAY(graph->mapping, graph->column_capacity * 2); + REALLOC_ARRAY(graph->new_mapping, graph->column_capacity * 2); } /* @@@ -1155,20 -1161,11 +1155,11 @@@ static void graph_padding_line(struct g */ for (i = 0; i < graph->num_columns; i++) { struct column *col = &graph->columns[i]; - struct commit *col_commit = col->commit; - if (col_commit == graph->commit) { - strbuf_write_column(sb, col, '|'); - - if (graph->num_parents < 3) - strbuf_addch(sb, ' '); - else { - int num_spaces = ((graph->num_parents - 2) * 2); - strbuf_addchars(sb, ' ', num_spaces); - } - } else { - strbuf_write_column(sb, col, '|'); + strbuf_write_column(sb, col, '|'); + if (col->commit == graph->commit && graph->num_parents > 2) + strbuf_addchars(sb, ' ', (graph->num_parents - 2) * 2); + else strbuf_addch(sb, ' '); - } } graph_pad_horizontally(graph, sb, graph->num_columns);