Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH] GSoC2014 microprojects #6 Change bundle.c:add_to_ref_list() to use ALLOC_GROW()

From: Philip Oakley <hidden>
Date: 2016-06-15 23:00:01

From: "Sun He" <redacted>
quoted hunk ↗ jump to hunk
Signed-off-by: Sun He <redacted>
---
bundle.c |    6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/bundle.c b/bundle.c
index 7809fbb..1a7b7eb 100644
--- a/bundle.c
+++ b/bundle.c
@@ -14,11 +14,7 @@ static const char bundle_signature[] = "# v2 git 
bundle\n";
static void add_to_ref_list(const unsigned char *sha1, const char 
*name,
 struct ref_list *list)
{
- if (list->nr + 1 >= list->alloc) {
- list->alloc = alloc_nr(list->nr + 1);
- list->list = xrealloc(list->list,
- list->alloc * sizeof(list->list[0]));
- }
+    ALLOC_GROW(list->list,list->nr,list->alloc);
 hashcpy(list->list[list->nr].sha1, sha1);
Isn't this on top of your other micro-project patch?

If so, it is worth including a note after your signoff and --- to say 
that, so they get applied in the right order :: The principle of least 
surprise.
 list->list[list->nr].name = xstrdup(name);
 list->nr++;
-- 
1.7.1

--
Philip 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help