git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/3] It's C not C++ so variable length array should not be used [-Werror=vla] :,).

From
Shahzad Lone <shahzadlone@gmail.com>
Date
Feb 1, 2019, 08:36 UTC
Message-ID
<01020168a8338127-d50bd8d1-c178-4f13-86b1-9a191f64ded0-000000@eu-west-1.amazonses.com>
In-Reply-To
<01020168a8338064-b1c054c4-3e05-4825-b8dc-636d9c63dcfc-000000@eu-west-1.amazonses.com>
---
 builtin/pack-objects.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index c1ec9ef3232cb..3017beb8236fa 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -197,9 +197,8 @@ static unsigned long write_large_blob_data(struct git_istream *st, struct hashfi
 					   const struct object_id *oid)
 {
 	git_zstream stream;
-	const unsigned bufsize = 16384;
-	unsigned char ibuf[bufsize];
-	unsigned char obuf[bufsize];
+	unsigned char ibuf[16384];
+	unsigned char obuf[16384];
 	unsigned long olen = 0;
 
 	git_deflate_init(&stream, pack_compression_level);

--
https://github.com/git/git/pull/572
Previous: Shahzad LoneNext: Eric Sunshine
Message 2 of 9 in “[Enhancement] Improve internals / refactoring.”
  1. 1/3 [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 1, 2019
  2. 3/3 It's C not C++ so variable length array should not be used [-Werror=vla] :,).Shahzad Lone, Feb 1, 2019
  3. Eric SunshineFeb 1, 2019
  4. 2/3 ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] so fix that.Shahzad Lone, Feb 1, 2019
  5. Eric SunshineFeb 1, 2019
  6. ] [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 1, 2019
  7. Brandon RichardsonFeb 2, 2019
  8. ] [Enhancement] Improve internals / refactoring.Shahzad Lone, Feb 2, 2019
  9. Junio C HamanoFeb 4, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.