]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
libudev-queue: use assert_return()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 24 Aug 2018 04:41:22 +0000 (13:41 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 11 Sep 2018 03:45:21 +0000 (12:45 +0900)
src/libudev/libudev-queue.c

index a62ba5ebfed9a22d4c12b6bc86dedf14a28cee04..e7d8ffea4cac4973a3fa7187c1ab37d7f1af1b68 100644 (file)
@@ -94,12 +94,9 @@ DEFINE_PUBLIC_TRIVIAL_REF_UNREF_FUNC(struct udev_queue, udev_queue, udev_queue_f
  *
  * Returns: the udev library context.
  **/
-_public_ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue)
-{
-        if (udev_queue == NULL) {
-                errno = EINVAL;
-                return NULL;
-        }
+_public_ struct udev *udev_queue_get_udev(struct udev_queue *udev_queue) {
+        assert_return_errno(udev_queue, NULL, EINVAL);
+
         return udev_queue->udev;
 }
 
@@ -238,7 +235,7 @@ _public_ int udev_queue_get_fd(struct udev_queue *udev_queue) {
 _public_ int udev_queue_flush(struct udev_queue *udev_queue) {
         int r;
 
-        assert(udev_queue);
+        assert_return(udev_queue, -EINVAL);
 
         if (udev_queue->fd < 0)
                 return -EINVAL;