Subject: [PATCH v2 08/11] replace_object.c: change register_replace_object() to use ALLOC_GROW()

From: "Dmitry S. Dolzhenko" <[email-masked]>
Date: Fri, 28 Feb 2014 13:45:41 +0400

Signed-off-by: Dmitry S. Dolzhenko <[email-masked]>
---
 replace_object.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/replace_object.c b/replace_object.c
index cdcaf8c..843deef 100644
--- a/replace_object.c
+++ b/replace_object.c
@@ -36,12 +36,8 @@ static int register_replace_object(struct replace_object *replace,
 		return 1;
 	}
 	pos = -pos - 1;
-	if (replace_object_alloc <= ++replace_object_nr) {
-		replace_object_alloc = alloc_nr(replace_object_alloc);
-		replace_object = xrealloc(replace_object,
-					  sizeof(*replace_object) *
-					  replace_object_alloc);
-	}
+	ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc);
+	replace_object_nr++;
 	if (pos < replace_object_nr)
 		memmove(replace_object + pos + 1,
 			replace_object + pos,
-- 
1.8.5.3