From: <svn...@op...> - 2009-07-13 15:41:59
|
Author: bellmich Date: Mon Jul 13 17:41:49 2009 New Revision: 1203 URL: http://libsyncml.opensync.org/changeset/1203 Log: more robust error setting Question: Is this a GCC feature or a C99 feature? Modified: trunk/libsyncml/sml_error_internals.h Modified: trunk/libsyncml/sml_error_internals.h ============================================================================== --- trunk/libsyncml/sml_error_internals.h Mon Jul 13 16:03:02 2009 (r1202) +++ trunk/libsyncml/sml_error_internals.h Mon Jul 13 17:41:49 2009 (r1203) @@ -29,9 +29,11 @@ smlAssertMsg(*error == NULL, "The error parameter is already filled (ignored error)."); #define SML_ERROR g_quark_from_static_string("Sml") -#define SML_SET_ERROR(error,type,...) \ +#define SML_SET_ERROR(error, type, format, ...) \ {\ - gchar *__sml_error_string = g_strdup_printf(__VA_ARGS__); \ + gchar *__sml_error_string = NULL; \ + if (format) \ + __sml_error_string = g_strdup_printf(format, ##__VA_ARGS__); \ if (__sml_error_string && strlen(__sml_error_string)) \ g_set_error(error, SML_ERROR, type, "%s %s", smlErrorTypeGetMessage(type), __sml_error_string); \ else \ |