[glib/wip/3v1n0/g_str_has_optimization: 7/7] gstrfuncs: workaround build failure with some compilers




commit d9718b190781d0b6926b4d904329d5a6930189e2
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Thu Oct 13 02:18:00 2022 +0200

    gstrfuncs: workaround build failure with some compilers
    
    For some reason we may get warnings about using NULL parameters, while
    this is impossible

 glib/gstrfuncs.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/glib/gstrfuncs.h b/glib/gstrfuncs.h
index 19eb291bef..f8c09f335a 100644
--- a/glib/gstrfuncs.h
+++ b/glib/gstrfuncs.h
@@ -151,8 +151,8 @@ gboolean g_str_has_prefix (const gchar *str,
   (((STR) != NULL && (PREFIX) != NULL && __builtin_constant_p ((PREFIX))) ? \
     G_GNUC_EXTENSION ({                                                     \
       G_STATIC_ASSERT (sizeof (PREFIX[0]) == sizeof (char));                \
-      const char *const __str = ((STR));                                    \
-      const char *const __prefix = ((PREFIX));                              \
+      const char *const __str = ((STR) + !(STR));                           \
+      const char *const __prefix = ((PREFIX) + !(PREFIX));                  \
       const size_t __str_len = strlen (__str);                              \
       const size_t __prefix_len = sizeof ((PREFIX)) - 1;                    \
       (__str_len >= __prefix_len) ?                                         \
@@ -165,8 +165,8 @@ gboolean g_str_has_prefix (const gchar *str,
   (((STR) != NULL && (SUFFIX) != NULL && __builtin_constant_p ((SUFFIX))) ? \
     G_GNUC_EXTENSION ({                                                     \
       G_STATIC_ASSERT (sizeof (SUFFIX[0]) == sizeof (char));                \
-      const char *const __str = ((STR));                                    \
-      const char *const __suffix = ((SUFFIX));                              \
+      const char *const __str = ((STR) + !(STR));                           \
+      const char *const __suffix = ((SUFFIX) + !(SUFFIX));                  \
       const size_t __str_len = strlen (__str);                              \
       const size_t __suffix_len = sizeof ((SUFFIX)) - 1;                    \
       (__str_len >= __suffix_len) ?                                         \


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