summaryrefslogtreecommitdiff
path: root/graph.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:45 (GMT)
commit1c2ea2cdc0e8c4e5af942c51b234c5af527944f6 (patch)
tree26554b52f6dcd97e2194c4b0c32106b6a2b72f92 /graph.c
parentb33000878a88b52816b97aeb88ba3677902ad277 (diff)
parent2756ca4347cbda05b16954cd7f445c216b935e76 (diff)
downloadgit-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.zip
git-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.tar.gz
git-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.tar.bz2
Merge branch 'rs/realloc-array'
Code cleanup. * rs/realloc-array: use REALLOC_ARRAY for changing the allocation size of arrays add macro REALLOC_ARRAY
Diffstat (limited to 'graph.c')
-rw-r--r--graph.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/graph.c b/graph.c
index dfb99f6..23fff73 100644
--- a/graph.c
+++ b/graph.c
@@ -267,16 +267,10 @@ static void graph_ensure_capacity(struct git_graph *graph, int num_columns)
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);
}
/*