From bbd13786c4b2e9f67b7908f20a4ddb19e7057b43 Mon Sep 17 00:00:00 2001 From: Evan Nemerson Date: Sun, 18 May 2014 00:25:06 -0700 Subject: [PATCH] gudev: add missing (nullable) annotations on return values --- src/gudev/gudevclient.c | 17 ++++++++++++----- src/gudev/gudevdevice.c | 32 ++++++++++++++++++++++---------- 2 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/gudev/gudevclient.c b/src/gudev/gudevclient.c index a151b50..1eec758 100644 --- a/src/gudev/gudevclient.c +++ b/src/gudev/gudevclient.c @@ -338,7 +338,10 @@ g_udev_client_new (const gchar * const *subsystems) * * Gets all devices belonging to @subsystem. * - * Returns: (element-type GUdevDevice) (transfer full): A list of #GUdevDevice objects. The caller should free the result by using g_object_unref() on each element in the list and then g_list_free() on the list. + * Returns: (nullable) (element-type GUdevDevice) (transfer full): A + * list of #GUdevDevice objects. The caller should free the result by + * using g_object_unref() on each element in the list and then + * g_list_free() on the list. */ GList * g_udev_client_query_by_subsystem (GUdevClient *client, @@ -391,7 +394,8 @@ g_udev_client_query_by_subsystem (GUdevClient *client, * * Looks up a device for a type and device number. * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice object or %NULL + * if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_device_number (GUdevClient *client, @@ -423,7 +427,8 @@ g_udev_client_query_by_device_number (GUdevClient *client, * * Looks up a device for a device file. * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice object or %NULL + * if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_device_file (GUdevClient *client, @@ -459,7 +464,8 @@ g_udev_client_query_by_device_file (GUdevClient *client, * * Looks up a device for a sysfs path. * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice object or %NULL + * if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_sysfs_path (GUdevClient *client, @@ -491,7 +497,8 @@ g_udev_client_query_by_sysfs_path (GUdevClient *client, * * Looks up a device for a subsystem and name. * - * Returns: (transfer full): A #GUdevDevice object or %NULL if the device was not found. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice object or %NULL + * if the device was not found. Free with g_object_unref(). */ GUdevDevice * g_udev_client_query_by_subsystem_and_name (GUdevClient *client, diff --git a/src/gudev/gudevdevice.c b/src/gudev/gudevdevice.c index 2c768b7..7106719 100644 --- a/src/gudev/gudevdevice.c +++ b/src/gudev/gudevdevice.c @@ -228,7 +228,8 @@ g_udev_device_get_sysfs_path (GUdevDevice *device) * * Gets the name of the driver used for @device. * - * Returns: The name of the driver for @device or %NULL if unknown. + * Returns: (nullable): The name of the driver for @device or %NULL if + * unknown. */ const gchar * g_udev_device_get_driver (GUdevDevice *device) @@ -325,8 +326,8 @@ g_udev_device_get_device_number (GUdevDevice *device) * * Gets the device file for @device. * - * Returns: The device file for @device or %NULL if no device file - * exists. + * Returns: (nullable): The device file for @device or %NULL if no + * device file exists. */ const gchar * g_udev_device_get_device_file (GUdevDevice *device) @@ -375,7 +376,8 @@ g_udev_device_get_device_file_symlinks (GUdevDevice *device) * * Gets the immediate parent of @device, if any. * - * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice or %NULL if + * @device has no parent. Free with g_object_unref(). */ GUdevDevice * g_udev_device_get_parent (GUdevDevice *device) @@ -406,7 +408,9 @@ g_udev_device_get_parent (GUdevDevice *device) * Walks up the chain of parents of @device and returns the first * device encountered where @subsystem and @devtype matches, if any. * - * Returns: (transfer full): A #GUdevDevice or %NULL if @device has no parent with @subsystem and @devtype. Free with g_object_unref(). + * Returns: (nullable) (transfer full): A #GUdevDevice or %NULL if + * @device has no parent with @subsystem and @devtype. Free with + * g_object_unref(). */ GUdevDevice * g_udev_device_get_parent_with_subsystem (GUdevDevice *device, @@ -492,7 +496,8 @@ g_udev_device_has_property (GUdevDevice *device, * * Look up the value for @key on @device. * - * Returns: The value for @key or %NULL if @key doesn't exist on @device. Do not free this string, it is owned by @device. + * Returns: (nullable): The value for @key or %NULL if @key doesn't + * exist on @device. Do not free this string, it is owned by @device. */ const gchar * g_udev_device_get_property (GUdevDevice *device, @@ -664,7 +669,10 @@ split_at_whitespace (const gchar *s) * horizontal tab ('\t'), and vertical tab ('\v') are considered; the * locale is not taken into account). * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of @key on @device split into tokens or %NULL if @key doesn't exist. This array is owned by @device and should not be freed by the caller. + * Returns: (nullable) (transfer none) (array zero-terminated=1) (element-type utf8): + * The value of @key on @device split into tokens or %NULL if @key + * doesn't exist. This array is owned by @device and should not be + * freed by the caller. */ const gchar* const * g_udev_device_get_property_as_strv (GUdevDevice *device, @@ -758,8 +766,9 @@ g_udev_device_has_sysfs_attr (GUdevDevice *device, * * Look up the sysfs attribute with @name on @device. * - * Returns: The value of the sysfs attribute or %NULL if there is no - * such attribute. Do not free this string, it is owned by @device. + * Returns: (nullable): The value of the sysfs attribute or %NULL if + * there is no such attribute. Do not free this string, it is owned by + * @device. */ const gchar * g_udev_device_get_sysfs_attr (GUdevDevice *device, @@ -907,7 +916,10 @@ g_udev_device_get_sysfs_attr_as_boolean (GUdevDevice *device, * tab ('\t'), and vertical tab ('\v') are considered; the locale is * not taken into account). * - * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): The value of the sysfs attribute split into tokens or %NULL if there is no such attribute. This array is owned by @device and should not be freed by the caller. + * Returns: (nullable) (transfer none) (array zero-terminated=1) (element-type utf8): + * The value of the sysfs attribute split into tokens or %NULL if + * there is no such attribute. This array is owned by @device and + * should not be freed by the caller. */ const gchar * const * g_udev_device_get_sysfs_attr_as_strv (GUdevDevice *device, -- 1.9.0