]> git.alsa-project.org Git - alsa-gobject.git/commitdiff
hwdep: check whether method argument for GError is available
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)
committerTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 15 Nov 2020 14:04:32 +0000 (23:04 +0900)
In Rules for use of GError, the check of arguments for GError may be
preferable to avoid to unexpected function call.

This commit adds the check.

Reference: https://developer.gnome.org/glib/stable/glib-Error-Reporting.html
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
src/hwdep/query.c

index daefd18961e34ab99f7213a83608054deadb92bc..1291628d85b0dc3154c1e11a465468350c538063 100644 (file)
@@ -147,6 +147,7 @@ void alsahwdep_get_device_id_list(guint card_id, guint **entries,
 
     g_return_if_fail(entries != NULL);
     g_return_if_fail(entry_count != NULL);
+    g_return_if_fail(error == NULL || *error == NULL);
 
     prepare_udev_enum(&enumerator, error);
     if (*error != NULL)
@@ -224,6 +225,8 @@ void alsahwdep_get_hwdep_sysname(guint card_id, guint device_id,
     struct udev *ctx;
     struct udev_device *dev;
 
+    g_return_if_fail(error == NULL || *error == NULL);
+
     length = strlen(HWDEP_SYSNAME_TEMPLATE) + calculate_digits(card_id) +
              calculate_digits(device_id) + 1;
     name = g_malloc0(length);
@@ -269,6 +272,8 @@ void alsahwdep_get_hwdep_devnode(guint card_id, guint device_id,
     struct udev_device *dev;
     const char *node;
 
+    g_return_if_fail(error == NULL || *error == NULL);
+
     length = strlen(HWDEP_SYSNAME_TEMPLATE) + calculate_digits(card_id) +
              calculate_digits(device_id) + 1;
     name = g_malloc0(length);
@@ -370,6 +375,7 @@ void alsahwdep_get_device_info(guint card_id, guint device_id,
     struct snd_hwdep_info *info;
 
     g_return_if_fail(device_info != NULL);
+    g_return_if_fail(error == NULL || *error == NULL);
 
     *device_info = g_object_new(ALSAHWDEP_TYPE_DEVICE_INFO, NULL);
     hwdep_device_info_refer_private(*device_info, &info);