diff options
Diffstat (limited to 'src/libudev/util.h')
-rw-r--r-- | src/libudev/util.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libudev/util.h b/src/libudev/util.h index 18109938e0..88bd771a82 100644 --- a/src/libudev/util.h +++ b/src/libudev/util.h @@ -283,3 +283,11 @@ static inline void _reset_errno_(int *saved_errno) { } #define PROTECT_ERRNO _cleanup_(_reset_errno_) __attribute__((unused)) int _saved_errno_ = errno + +static inline void qsort_safe(void *base, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) { + if (nmemb) { + assert(base); + qsort(base, nmemb, size, compar); + } +} |