[tepl] FileContentLoader: fix compil warnings



commit f9e548467700ae9a5bb0eb495d3d6f485d620c0f
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Mon Nov 4 05:36:11 2019 +0100

    FileContentLoader: fix compil warnings
    
    The warnings were:
    warning: function called through a non-compatible type
    
    In the first case, chunk can be NULL but there is directly a return so
    it's not needed to set chunk to NULL afterwards.
    
    In the second case, we know that chunk is not NULL.

 tepl/tepl-file-content-loader.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tepl/tepl-file-content-loader.c b/tepl/tepl-file-content-loader.c
index d475c1d..21657ef 100644
--- a/tepl/tepl-file-content-loader.c
+++ b/tepl/tepl-file-content-loader.c
@@ -223,7 +223,11 @@ read_next_chunk_cb (GObject      *source_object,
        if (error != NULL)
        {
                g_task_return_error (task, error);
-               g_clear_pointer (&chunk, (GDestroyNotify)g_bytes_unref);
+
+               if (chunk != NULL)
+               {
+                       g_bytes_unref (chunk);
+               }
                return;
        }
 
@@ -243,7 +247,8 @@ read_next_chunk_cb (GObject      *source_object,
        }
 
        _tepl_file_content_add_chunk (loader->priv->content, chunk);
-       g_clear_pointer (&chunk, (GDestroyNotify)g_bytes_unref);
+       g_bytes_unref (chunk);
+       chunk = NULL;
 
        task_data->total_bytes_read += chunk_size;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]