validate: Add helper functions ti print actions
authorThibault Saunier <tsaunier@gnome.org>
Wed, 4 Feb 2015 14:24:35 +0000 (15:24 +0100)
committerThibault Saunier <tsaunier@gnome.org>
Sat, 14 Feb 2015 15:32:10 +0000 (16:32 +0100)
API:
  + gst_validate_scenario_get_next_action
  + gst_validate_reporter_report_simple

https://bugzilla.gnome.org/show_bug.cgi?id=743994

validate/gst/validate/gst-validate-report.c
validate/gst/validate/gst-validate-report.h
validate/gst/validate/gst-validate-reporter.c
validate/gst/validate/gst-validate-reporter.h
validate/gst/validate/gst-validate-runner.c

index 1becf6b41f73d8d2e6fc2476688a457bbf42af4a..5befb6d9c219d919fb1e2f2bb0414ea17e2eed51 100644 (file)
@@ -504,6 +504,19 @@ gst_validate_printf (gpointer source, const gchar * format, ...)
   va_end (var_args);
 }
 
+/**
+ * gst_validate_print_action:
+ * @action: (allow-none): The source object to log
+ * @message: The message to print out in the GstValidate logging system
+ *
+ * Print @message to the GstValidate logging system
+ */
+void
+gst_validate_print_action (GstValidateAction * action, const gchar * message)
+{
+  gst_validate_printf_valist (action, message, NULL);
+}
+
 static void
 print_action_parametter (GString * string, GstValidateActionType * type,
     GstValidateActionParameter * param)
@@ -637,7 +650,10 @@ gst_validate_printf_valist (gpointer source, const gchar * format, va_list args)
     }
   }
 
-  g_string_append_vprintf (string, format, args);
+  if (args)
+    g_string_append_vprintf (string, format, args);
+  else
+    g_string_append (string, format);
 
   if (!newline_regex)
     newline_regex =
index dc6d184b0261a503c561dbc632f309dfe5d27b42..48a3607dee4a3ae717fdcc122ba64e5d57297a05 100644 (file)
@@ -32,6 +32,8 @@ typedef guintptr GstValidateIssueId;
 
 G_BEGIN_DECLS
 
+typedef struct _GstValidateAction          GstValidateAction;
+
 GType           gst_validate_report_get_type (void);
 #define GST_TYPE_VALIDATE_REPORT (gst_validate_report_get_type ())
 
@@ -213,6 +215,7 @@ const gchar *      gst_validate_report_level_get_name (GstValidateReportLevel le
 void               gst_validate_printf        (gpointer source,
                                                const gchar      * format,
                                                ...) G_GNUC_PRINTF (2, 3) G_GNUC_NO_INSTRUMENT;
+void               gst_validate_print_action  (GstValidateAction *action, const gchar * message);
 void               gst_validate_printf_valist (gpointer source,
                                                const gchar      * format,
                                                va_list            args) G_GNUC_NO_INSTRUMENT;
index 912b1e8c29c0d1b330628c901ba3cc761bb46668..c8994209687f634e1adbdc1fa8f1e5e69e63dc33 100644 (file)
@@ -268,6 +268,13 @@ gst_validate_report (GstValidateReporter * reporter,
   va_end (var_args);
 }
 
+void
+gst_validate_reporter_report_simple (GstValidateReporter * reporter,
+    GstValidateIssueId issue_id, const gchar * message)
+{
+  gst_validate_report (reporter, issue_id, message);
+}
+
 void
 gst_validate_reporter_set_name (GstValidateReporter * reporter, gchar * name)
 {
index 46fc608d560d83143dcd7f49660e45346e12edaa..79875706c802c25aa62857eeb976e80d715cafcf 100644 (file)
@@ -103,6 +103,9 @@ void gst_validate_report                       (GstValidateReporter * reporter,
                                           const gchar * format, ...);
 void gst_validate_report_valist                (GstValidateReporter * reporter, GstValidateIssueId issue_id,
                                           const gchar * format, va_list var_args);
+void
+gst_validate_reporter_report_simple (GstValidateReporter * reporter, GstValidateIssueId issue_id,
+                                          const gchar * message);
 
 void gst_validate_reporter_set_runner          (GstValidateReporter * reporter, GstValidateRunner *runner);
 void gst_validate_reporter_set_handle_g_logs   (GstValidateReporter * reporter);
index 322947498886645db73c5e5651e51b714664fc39..023f971d35e927899a082ae77672c7e4e329feb9 100644 (file)
@@ -166,7 +166,7 @@ _set_reporting_level_for_name (GstValidateRunner * runner,
 }
 
 static void
-_replace_double_colons (gchar *word)
+_replace_double_colons (gchar * word)
 {
   while (word) {
     word = strstr (word, "::");
@@ -461,7 +461,7 @@ _do_report_synthesis (GstValidateRunner * runner)
  * Returns: 0 if no critical error has been found and 18 if a critical
  * error has been detected. That return value is usually to be used as
  * exit code of the application.
- * */
+ */
 int
 gst_validate_runner_printf (GstValidateRunner * runner)
 {