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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Signed-off-by: Marius Storm-Olsen <mstormo@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]