*/
#include "config.h"
+#include "claws-features.h"
#include "libspamc.h"
#include "utils.h"
{
if (m->out != NULL)
free(m->out);
- if (m->raw != NULL)
+ if (m->raw != NULL && m->raw != m->out)
free(m->raw);
- if (m->priv != NULL)
+ if (m->priv != NULL && (char*)m->priv != m->out && (char*)m->priv != m->raw)
free(m->priv);
_clear_message(m);
}
WSADATA wsaData;
int nCode;
if ((nCode = WSAStartup(MAKEWORD(1, 1), &wsaData)) != 0) {
- printf("WSAStartup() returned error code %d\n", nCode);
+ g_print("WSAStartup() returned error code %d\n", nCode);
return EX_OSERR;
}
len += snprintf(buf+len, LOG_BUFSIZ-len, "\n");
buf[LOG_BUFSIZ] = '\0'; /* ensure termination */
- (void) write (2, buf, len);
-
+ if (write (2, buf, len) != len)
+ goto out;
} else {
vsnprintf(buf, LOG_BUFSIZ, msg, ap);
buf[LOG_BUFSIZ] = '\0'; /* ensure termination */
syslog (level, "%s", buf);
#else
(void) level; /* not used. suppress compiler warning */
- fprintf (stderr, "%s\n", buf);
+ g_printerr ("%s\n", buf);
#endif
}
-
+out:
va_end(ap);
}
return;
}
- printf("FAIL: input=%f != output=%f\n", input, output);
+ g_print("FAIL: input=%f != output=%f\n", input, output);
}
static void unit_test_locale_safe_string_to_float(void)
float num;
int i;
- printf("starting unit_test_locale_safe_string_to_float\n");
+ g_print("starting unit_test_locale_safe_string_to_float\n");
/* tests of precision */
for (i = 0; statictestset[i] != 0.0; i++) {
_test_locale_safe_string_to_float_val(statictestset[i]);
for (num = -1000.0; num < 1000.0; num += 0.01) {
_test_locale_safe_string_to_float_val(num);
}
- printf("finished unit_test_locale_safe_string_to_float\n");
+ g_print("finished unit_test_locale_safe_string_to_float\n");
}
void do_libspamc_unit_tests(void)