Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Define a wrapper to strings for when printf(%s,NULL) segfaults
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Mar 2005 07:44:20 +0000 (07:44 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Mar 2005 07:44:20 +0000 (07:44 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1126 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/portable.h

index 420ebd3..bd7c397 100644 (file)
@@ -131,5 +131,16 @@ const char *gras_wsa_err2string(int errcode);
 #  include "xbt/context_win32.h" /* Manual reimplementation for prehistoric platforms */
 #endif
 
 #  include "xbt/context_win32.h" /* Manual reimplementation for prehistoric platforms */
 #endif
 
+/**
+ ** What is needed to protect solaris's printf from ever seing NULL associated to a %s format
+ ** (without adding an extra check on linux :)
+ **/
+
+#ifdef PRINTF_NULL_WORKING
+#  define PRINTF_STR(a) (a)
+#else
+#  define PRINTF_STR(a) (a)?:"(null)"
+#endif
+  
 
 #endif /* GRAS_PORTABLE_H */
 
 #endif /* GRAS_PORTABLE_H */