gst: Add missing G_GNUC_NULL_TERMINATED markers

Functions that require NULL as their last vararg are marked so the
compiler can warn on missing NULL.

Also, document the NULL terminator for gst_make_element_message_details()
and gst_tracer_record_new().

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/669

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
This commit is contained in:
Chris White 2021-03-18 19:06:20 -04:00
parent c899d0a52c
commit a38d06cb1c
8 changed files with 10 additions and 8 deletions

View file

@ -58,7 +58,7 @@ GST_API
GstCapsFeatures * gst_caps_features_new_any (void);
GST_API
GstCapsFeatures * gst_caps_features_new (const gchar *feature1, ...);
GstCapsFeatures * gst_caps_features_new (const gchar *feature1, ...) G_GNUC_NULL_TERMINATED;
GST_API
GstCapsFeatures * gst_caps_features_new_valist (const gchar *feature1, va_list varargs);

View file

@ -3845,7 +3845,8 @@ _priv_gst_element_cleanup (void)
* @name: Name of the first field to set
* @...: variable arguments in the same form as #GstStructure
*
* Create a #GstStructure to be used with #gst_element_message_full_with_details
* Create a #GstStructure to be used with #gst_element_message_full_with_details.
* %NULL terminator required.
*
* Since: 1.10
*/

View file

@ -484,7 +484,7 @@ typedef enum
#define GST_ELEMENT_START_TIME(elem) (GST_ELEMENT_CAST(elem)->start_time)
GST_API
GstStructure *gst_make_element_message_details (const char *name, ...);
GstStructure *gst_make_element_message_details (const char *name, ...) G_GNUC_NULL_TERMINATED;
#define GST_ELEMENT_MESSAGE_MAKE_DETAILS(args) gst_make_element_message_details args

View file

@ -201,7 +201,7 @@ GST_API
GstTagList * gst_tag_list_new_empty (void) G_GNUC_MALLOC;
GST_API
GstTagList * gst_tag_list_new (const gchar * tag, ...) G_GNUC_MALLOC;
GstTagList * gst_tag_list_new (const gchar * tag, ...) G_GNUC_NULL_TERMINATED G_GNUC_MALLOC;
GST_API
GstTagList * gst_tag_list_new_valist (va_list var_args) G_GNUC_MALLOC;

View file

@ -159,6 +159,7 @@ gst_tracer_record_init (GstTracerRecord * self)
*
* Create a new tracer record. The record instance can be used to efficiently
* log entries using gst_tracer_record_log().
* %NULL terminator required after the last argument.
*
* The @name without the ".class" suffix will be used for the log records.
* There must be fields for each value that gets logged where the field name is

View file

@ -92,7 +92,7 @@ typedef enum
} GstTracerValueFlags;
GST_API
GstTracerRecord * gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...);
GstTracerRecord * gst_tracer_record_new (const gchar * name, const gchar * firstfield, ...) G_GNUC_NULL_TERMINATED;
#ifndef GST_DISABLE_GST_DEBUG
GST_API

View file

@ -196,7 +196,7 @@ GST_API
void gst_type_find_suggest_simple (GstTypeFind * find,
guint probability,
const char * media_type,
const char * fieldname, ...);
const char * fieldname, ...) G_GNUC_NULL_TERMINATED;
GST_API
guint64 gst_type_find_get_length (GstTypeFind * find);

View file

@ -337,12 +337,12 @@ GstElement * gst_harness_find_element (GstHarness * h,
GST_CHECK_API
void gst_harness_set (GstHarness * h,
const gchar * element_name,
const gchar * first_property_name, ...);
const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED;
GST_CHECK_API
void gst_harness_get (GstHarness * h,
const gchar * element_name,
const gchar * first_property_name, ...);
const gchar * first_property_name, ...) G_GNUC_NULL_TERMINATED;
GST_CHECK_API
void gst_harness_add_probe (GstHarness * h,