[PATCH 11/11] Add support for Mingw

Mike Hommey mh+jemalloc at glandium.org
Thu Apr 19 10:26:06 PDT 2012

On Wed, Apr 18, 2012 at 06:29:50PM +0200, Mike Hommey wrote:
>  int
>  buferror(int errnum, char *buf, size_t buflen)
> +#ifdef _WIN32
> +	FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0, (LPSTR)buf, buflen, NULL);
> +	return (0);
> +#elif defined(_GNU_SOURCE)
>  	char *b = strerror_r(errno, buf, buflen);

Note that there is an error in buferror: it ignores the errnum argument.
Which is okayish, since it's always called for errno. There are two
ways out here:
- actually using the given argument
- remove that argument

I'd go for the latter... Anyways, there are other errno-related things
I need to change for MSVC, so it's fine to land this patch as-is.



More information about the jemalloc-discuss mailing list