[PATCH v3 2/2] alloc.c: remove the redundant commit_count variable
- From
Ramsay Jones <ramsay@ramsay1.demon.co.uk>
- Date
- Jul 10, 2014, 23:59 UTC
- Message-ID
- <53BF28F4.8050704@ramsay1.demon.co.uk>
The 'commit_count' static variable is used in alloc_commit_node() to set the 'index' field of the commit structure to a unique value. This variable assumes the same value as the 'count' field of the 'commit_state' allocator state structure, which may be used in its place.
Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> --- alloc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/alloc.c b/alloc.c index d7c3605..c6687f9 100644 --- a/alloc.c +++ b/alloc.c @@ -64,9 +64,8 @@ static struct alloc_state commit_state; void *alloc_commit_node(void) { - static int commit_count; struct commit *c = alloc_node(&commit_state, sizeof(struct commit)); - c->index = commit_count++; + c->index = commit_state.count - 1; return c; }
-- 2.0.0