G_GNUC_PRINTF (3, 4) static void
ai_app_validate_add (AsAppValidateHelper *helper,
		     AsProblemKind kind,
		     const gchar *fmt, ...)
{
	AsProblem *problem;
	guint i;
	va_list args;
	g_autofree gchar *str = NULL;

	va_start (args, fmt);
	str = g_strdup_vprintf (fmt, args);
	va_end (args);

	/* don't care about style when relaxed */
	if (helper->flags & AS_APP_VALIDATE_FLAG_RELAX &&
	    kind == AS_PROBLEM_KIND_STYLE_INCORRECT)
		return;

	/* already added */
	for (i = 0; i < helper->probs->len; i++) {
		problem = g_ptr_array_index (helper->probs, i);
		if (g_strcmp0 (as_problem_get_message (problem), str) == 0)
			return;
	}

	/* add new problem to list */
	problem = as_problem_new ();
	as_problem_set_kind (problem, kind);
	as_problem_set_message (problem, str);
	g_debug ("Adding %s '%s'", as_problem_kind_to_string (kind), str);
	g_ptr_array_add (helper->probs, problem);
}
/**
 * ai_app_validate_add:
 */
static void
ai_app_validate_add (GPtrArray *problems,
		     AsProblemKind kind,
		     const gchar *str)
{
	AsProblem *problem;
	guint i;

	/* already added */
	for (i = 0; i < problems->len; i++) {
		problem = g_ptr_array_index (problems, i);
		if (g_strcmp0 (as_problem_get_message (problem), str) == 0)
			return;
	}

	/* add new problem to list */
	problem = as_problem_new ();
	as_problem_set_kind (problem, kind);
	as_problem_set_message (problem, str);
	g_debug ("Adding %s '%s'", as_problem_kind_to_string (kind), str);
	g_ptr_array_add (problems, problem);
}