gdkjpeg: include `stdlib.h` necessary for `free`
authorMosè Giordano <mose@gnu.org>
Sun, 6 Feb 2022 15:41:33 +0000 (15:41 +0000)
committerMosè Giordano <mose@gnu.org>
Sun, 6 Feb 2022 15:41:33 +0000 (15:41 +0000)
`free` is defined in `stdlib.h`, see for example
<https://pubs.opengroup.org/onlinepubs/009604499/functions/free.html>.  Without
this include compilation can fail with the following error:

```
../gdk/loaders/gdkjpeg.c: In function ‘gdk_save_jpeg’:
../gdk/loaders/gdkjpeg.c:264:7: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
       free (data);
       ^
../gdk/loaders/gdkjpeg.c:264:7: warning: incompatible implicit declaration of built-in function ‘free’
../gdk/loaders/gdkjpeg.c:264:7: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
../gdk/loaders/gdkjpeg.c:302:67: error: ‘free’ undeclared (first use in this function)
   return g_bytes_new_with_free_func (data, size, (GDestroyNotify) free, NULL);
                                                                   ^
../gdk/loaders/gdkjpeg.c:302:67: note: each undeclared identifier is reported only once for each function it appears in
../gdk/loaders/gdkjpeg.c:303:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
```

gdk/loaders/gdkjpeg.c

index 8cbb0438a4e061840aeb6ab435631d1bee364ecd..8f7e422f0c0528ecaf3739ed731d19a20162f9ef 100644 (file)
@@ -15,6 +15,8 @@
  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <stdlib.h>
+
 #include "config.h"
 
 #include "gdkjpegprivate.h"