Thread (38 messages) flat view 38 messages, 10 authors, 2016-08-13
STALE3672d

Revision rfc of 4 in this series.

Revisions (4)
  1. rfc current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]

[PATCH 01/14] Fix non-constant array creation

From: Marius Storm-Olsen <hidden>
Date: 2016-06-15 22:47:17
Subsystem: the rest · Maintainer: Linus Torvalds

MSVC doesn't munge the non-constant expression, so use xmalloc instead.

Signed-off-by: Marius Storm-Olsen <redacted>
---
 builtin-apply.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index ae11b41..0f19965 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1875,7 +1875,7 @@ static int match_fragment(struct image *img,
 		size_t imgoff = 0;
 		size_t preoff = 0;
 		size_t postlen = postimage->len;
-		size_t imglen[preimage->nr];
+		size_t *imglen = xmalloc(sizeof(size_t) * preimage->nr);
 		for (i = 0; i < preimage->nr; i++) {
 			size_t prelen = preimage->line[i].len;
 
@@ -1901,6 +1901,7 @@ static int match_fragment(struct image *img,
 		memcpy(fixed_buf, img->buf + try, imgoff);
 		for (i = 0; i < preimage->nr; i++)
 			preimage->line[i].len = imglen[i];
+		free(imglen);
 
 		/*
 		 * Update the preimage buffer and the postimage context lines.
-- 
1.6.3.msysgit.0.18.gef407
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help