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

[PATCH] compat/mingw: brown paper bag fix for 50a6c8e

From
Jeff King <peff@peff.net>
Date
Feb 29, 2016, 09:28 UTC
Message-ID
<20160229092816.GA23910@sigill.intra.peff.net>
In-Reply-To
<56D3E56A.5010608@web.de>
On Mon, Feb 29, 2016 at 07:30:02AM +0100, Torsten Bögershausen wrote:
Show 8 quoted lines
> I haven't digged further,
> but trying to verify t9115 under Windows gave this:
> 
> compat/mingw.c: In function 'mingw_spawnve_fd':
> compat/mingw.c:1072:10: warning: implicit declaration of function
> 'xmalloc_array' [-Wimplicit-function-declaration]
>   wargs = xmalloc_array(st_add(st_mult(2, args.len), 1), sizeof(wchar_t));
>           ^
Yikes.
-- >8 --
Subject: [PATCH] compat/mingw: brown paper bag fix for 50a6c8e

Commit 50a6c8e (use st_add and st_mult for allocation size computation, 2016-02-22) fixed up many xmalloc call-sites including ones in compat/mingw.c.

But I screwed up one of them, which was half-converted to ALLOC_ARRAY, using a very early prototype of the function. And I never caught it because I don't build on Windows.

Signed-off-by: Jeff King <peff@peff.net>
---
I think this means "master" is broken for mingw builds.

Sorry, Windows people, for breaking your build. I'm happy to hold back such repo-wide cleanups from the mingw code in the future, since I can't actually compile them. But the flipside is that if I _do_ improve things, you don't get the benefit until somebody manually ports it over.

 compat/mingw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/compat/mingw.c b/compat/mingw.c
index cfedcf9..54c82ec 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -1069,7 +1069,7 @@ static pid_t mingw_spawnve_fd(const char *cmd, const char **argv, char **deltaen
 			free(quoted);
 	}
 
-	wargs = xmalloc_array(st_add(st_mult(2, args.len), 1), sizeof(wchar_t));
+	ALLOC_ARRAY(wargs, st_add(st_mult(2, args.len), 1));
 	xutftowcs(wargs, args.buf, 2 * args.len + 1);
 	strbuf_release(&args);
 
-- 
2.8.0.rc0.276.gddf4100
Previous: Torsten BögershausenNext: Torsten Bögershausen
Message 2 of 18 in “50a6c8ef - xmalloc_array”
  1. Torsten BögershausenFeb 29, 2016
  2. compat/mingw: brown paper bag fix for 50a6c8eJeff King, Feb 29, 2016
  3. Torsten BögershausenFeb 29, 2016
  4. Jeff KingFeb 29, 2016
  5. Compiler warning under cygwin/mingw (was: fix for 50a6c8e)Torsten Bögershausen, Feb 29, 2016
  6. Jeff KingFeb 29, 2016
  7. SZEDER GáborFeb 29, 2016
  8. Junio C HamanoApr 12, 2016
  9. Junio C HamanoMay 10, 2016
  10. Ramsay JonesFeb 29, 2016
  11. Ramsay JonesMar 3, 2016
  12. Ramsay JonesMar 3, 2016
  13. Junio C HamanoFeb 29, 2016
  14. Jeff KingFeb 29, 2016
  15. Torsten BögershausenMar 1, 2016
  16. Jeff KingMar 1, 2016
  17. Johannes SchindelinMar 1, 2016
  18. Johannes SchindelinFeb 29, 2016

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.