[gtk: 1/2] gdkjpeg: include `stdlib.h` necessary for `free`
- From: Matthias Clasen <matthiasc src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [gtk: 1/2] gdkjpeg: include `stdlib.h` necessary for `free`
 
- Date: Mon,  7 Feb 2022 23:53:39 +0000 (UTC)
 
commit 4c211f1872eb6b1cd937bd98dc86b571fc87f304
Author: Mosè Giordano <mose gnu org>
Date:   Sun Feb 6 15:41:33 2022 +0000
    gdkjpeg: include `stdlib.h` necessary for `free`
    
    `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 | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gdk/loaders/gdkjpeg.c b/gdk/loaders/gdkjpeg.c
index 8cbb0438a4..8f7e422f0c 100644
--- a/gdk/loaders/gdkjpeg.c
+++ b/gdk/loaders/gdkjpeg.c
@@ -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"
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]