[glib/fix-gstrerror-warning: 4/4] Fix a compiler waring in g_strerror




commit 74429734ee66a5d03d2d73e57bb419a001224346
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 16 19:00:10 2022 -0400

    Fix a compiler waring in g_strerror
    
    Msvc is complaining about this code, lets try
    to help it see the light.
    
    See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2800

 glib/gstrfuncs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
index ee934e5d76..c74bf221be 100644
--- a/glib/gstrfuncs.c
+++ b/glib/gstrfuncs.c
@@ -1362,7 +1362,7 @@ g_strerror (gint errnum)
           G_UNLOCK (errors);
 
           errno = saved_errno;
-          return msg;
+          return NULL;
         }
 
       if (!g_get_console_charset (NULL))
@@ -1378,6 +1378,8 @@ g_strerror (gint errnum)
     }
   G_UNLOCK (errors);
 
+  g_assert (msg != buf);
+
   errno = saved_errno;
   return msg;
 }


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