[Mesa-dev] [PATCH] util: include missing stdlib header

Eric Engestrom eric at engestrom.ch
Wed May 1 15:29:12 UTC 2019


On 2019-05-01 at 08:18, Juan A. Suarez Romero <jasuarez at igalia.com> wrote:
> Fixes scons/mingw building:
> 
> src/util/os_file.c: In function ‘os_read_file’:
> src/util/os_file.c:126:11: error: ‘NULL’ undeclared (first use in this 
> function); did you mean ‘_DLL’?
>     return NULL;
>            ^~~~
>            _DLL
> src/util/os_file.c:126:11: note: each undeclared identifier is reported 
> only once for each function it appears in
> 
> Fixes: 316964709e2 ("util: add os_read_file() helper")
> CC: Eric Engestrom <eric.engestrom at intel.com>
> ---
>  src/util/os_file.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/src/util/os_file.h b/src/util/os_file.h
> index 2f97c19ed55..97c42b0aefc 100644
> --- a/src/util/os_file.h
> +++ b/src/util/os_file.h
> @@ -12,6 +12,7 @@
>  extern "C" {
>  #endif
>  
> +#include <stdlib.h>

There is no `NULL` in this file, but os_file.c does have it.
It already has the right include though, I just mistakenly put it in the `#if linux` block.

I've just sent MR !778 to move the #include a couple lines up:
https://gitlab.freedesktop.org/mesa/mesa/merge_requests/778

Thanks for the report! I really need to add a mingw build to the CI :/

>  /*
>   * Read a file.
>   * Returns a char* that the caller must free(), or NULL and sets errno.
> -- 
> 2.20.1


More information about the mesa-dev mailing list