From 7f000106012f2e641b5fd0604f6668e61a0f44c7 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 10 Apr 2019 19:39:12 +0200 Subject: [PATCH] errno-util: rework ERRNO_IS_RESOURCE() from macro into static inline function No technical reason, except that later on we want to add a new ERRNO_IS() which uses the parameter twice and where we want to avoid double evaluation, and where we'd like to keep things in the same style. --- src/basic/errno-util.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/basic/errno-util.h b/src/basic/errno-util.h index f2677c7c19..ebb204128e 100644 --- a/src/basic/errno-util.h +++ b/src/basic/errno-util.h @@ -51,5 +51,9 @@ static inline bool ERRNO_IS_DISCONNECT(int r) { } /* Resource exhaustion, could be our fault or general system trouble */ -#define ERRNO_IS_RESOURCE(r) \ - IN_SET(abs(r), ENOMEM, EMFILE, ENFILE) +static inline bool ERRNO_IS_RESOURCE(int r) { + return IN_SET(abs(r), + EMFILE, + ENFILE, + ENOMEM); +}