changeset 258:0f055e94eb9c src

* fix the printerr() macros * add Bastien's typo-protection for debug install target
author mroi
date Sat, 15 Jan 2005 14:42:50 +0000
parents 0340d2236219
children 39d2fc310eb9
files dvdnav_internal.h
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dvdnav_internal.h	Mon Jan 03 20:24:21 2005 +0000
+++ b/dvdnav_internal.h	Sat Jan 15 14:42:50 2005 +0000
@@ -186,14 +186,18 @@
 /** USEFUL MACROS **/
 
 #ifdef __GNUC__
-#define printerrf(format, args...) snprintf(this->err_str, MAX_ERR_LEN, format, ## args);
+#define printerrf(format, args...) \
+	do { if (this) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); } while (0)
 #else
 #ifdef _MSC_VER
-#define printerrf(str) snprintf(this->err_str, MAX_ERR_LEN, str);
+#define printerrf(str) \
+	do { if (this) snprintf(this->err_str, MAX_ERR_LEN, str); } while (0)
 #else
-#define printerrf(...) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__);
+#define printerrf(...) \
+	do { if (this) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); } while (0)
 #endif /* WIN32 */
 #endif
-#define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN);
+#define printerr(str) \
+	do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN); } while (0)
 
 #endif /* DVDNAV_INTERNAL_H_INCLUDED */