X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Flibudev%2Flibudev-device.c;h=a8277d1363dc4b039d20dd6a01bd4c1edee5f337;hp=9ef4610a6af99e2bd77fb42ddbd4207931b7b239;hb=3cbd5f6be191a4e71fc85d8b893e96d6d65bf792;hpb=c8f8394a9309d4390daac70b736b34d0b6734f95 diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c index 9ef4610a6..a8277d136 100644 --- a/src/libudev/libudev-device.c +++ b/src/libudev/libudev-device.c @@ -1022,14 +1022,15 @@ _public_ struct udev_device *udev_device_ref(struct udev_device *udev_device) * Drop a reference of a udev device. If the refcount reaches zero, * the resources of the device will be released. * + * Returns: the passed udev device if it has still an active reference, or #NULL otherwise. **/ -_public_ void udev_device_unref(struct udev_device *udev_device) +_public_ struct udev_device *udev_device_unref(struct udev_device *udev_device) { if (udev_device == NULL) - return; + return NULL; udev_device->refcount--; if (udev_device->refcount > 0) - return; + return udev_device; if (udev_device->parent_device != NULL) udev_device_unref(udev_device->parent_device); free(udev_device->syspath); @@ -1049,6 +1050,7 @@ _public_ void udev_device_unref(struct udev_device *udev_device) free(udev_device->envp); free(udev_device->monitor_buf); free(udev_device); + return NULL; } /**