[glibmm] gmmproc: Pass 0 (NULL) instead of to C functions.



commit 5acce15576a91aec89c04b8fe5f8532b192acb71
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Sep 3 21:37:25 2013 +0200

    gmmproc: Pass 0 (NULL) instead of  to C functions.
    
    * tools/m4/convert_glib.m4: Avoid passing "" to C functions
      because some C developers insist on treating "" and NULL
      differently even when there is no meaningful distinction
      and when that means obviously unwanted behaviour in response
      to the "".
      Bug #686909
      And this should help with bug #702456 .

 tools/m4/convert_glib.m4 |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/tools/m4/convert_glib.m4 b/tools/m4/convert_glib.m4
index 67fb4ce..5b2ffe4 100644
--- a/tools/m4/convert_glib.m4
+++ b/tools/m4/convert_glib.m4
@@ -78,11 +78,11 @@ _CONVERSION(`gsize&',`gsize*',`&($3)')
 define(`__GCHARP_TO_USTRING',`Glib::convert_const_gchar_ptr_to_ustring($`'3)')
 define(`__GCHARP_TO_STDSTRING',`Glib::convert_const_gchar_ptr_to_stdstring($`'3)')
 
-_CONVERSION(`const Glib::ustring&',`const char*',`$3.c_str()')
-_CONVERSION(`const Glib::ustring&', `const guchar*', `(($2)$3.c_str())')
+_CONVERSION(`const Glib::ustring&',`const char*',`(($3).empty() ? 0 : $3.c_str())')
+_CONVERSION(`const Glib::ustring&', `const guchar*', `(($2)(($3).empty() ? 0 : $3.c_str()))')
 _CONVERSION(`const std::string&',`const char*',`$3.c_str()')
-_CONVERSION(`std::string',`const char*',`$3.c_str()')
-_CONVERSION(`const Glib::ustring&',`gchar*',`const_cast<gchar*>($3.c_str())')
+_CONVERSION(`std::string',`const char*',`(($3).empty() ? 0 : $3.c_str())')
+_CONVERSION(`const Glib::ustring&',`gchar*',`const_cast<gchar*>(($3).empty() ? 0 : $3.c_str())')
 _CONVERSION(`gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
 _CONVERSION(`const-gchar*',`Glib::ustring',__GCHARP_TO_USTRING)
 _CONVERSION(`const-guchar*',`Glib::ustring',__GCHARP_TO_USTRING)


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