Esempio n. 1
0
/**
 * CUnit error handler
 * Log message in a global var instead of printing in stderr
 *
 * CAUTION: Not stop execution on rterror case !!!
 */
static void cu_error_reporter(const char *fmt, va_list ap) {
	char *msg;

	/** This is a GNU extension.
	* Dunno how to handle errors here.
	 */
	if (!lw_vasprintf (&msg, fmt, ap)) {
		va_end (ap);
		return;
	}

	strncpy(cu_error_msg, msg, MAX_CUNIT_MSG_LENGTH);
	rtdealloc(msg);
}
Esempio n. 2
0
void
default_noticereporter(const char *fmt, va_list ap)
{
	char *msg;

	/*
	 * This is a GNU extension.
	 * Dunno how to handle errors here.
	 */
	if (!lw_vasprintf (&msg, fmt, ap))
	{
		va_end (ap);
		return;
	}
	printf("%s\n", msg);
	free(msg);
}
Esempio n. 3
0
void
pg_notice(const char *fmt, va_list ap)
{
	char *msg;

	/*
	 * This is a GNU extension.
	 * Dunno how to handle errors here.
	 */
	if (!lw_vasprintf (&msg, fmt, ap))
	{
		va_end (ap);
		return;
	}
	ereport(NOTICE, (errmsg_internal("%s", msg)));
	free(msg);
}
Esempio n. 4
0
/* Append variadic formatted string to a stringbuffer */
void
vasbappend(stringbuffer_t *sb, char *fmt, ... )
{
	va_list ap;
	char *msg;

	va_start(ap, fmt);

	if (!lw_vasprintf (&msg, fmt, ap))
	{
		va_end (ap);
		return;
	}

	/* Append to the stringbuffer */
	stringbuffer_append(sb, msg);
	free(msg);

	va_end(ap);
}