From bb3a59f1eff2ad2ac203d063cb714189955bbc93 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 1 Sep 2022 23:35:15 -0400 Subject: Factor out POSIX-style return pattern --- src/status.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/status.c') diff --git a/src/status.c b/src/status.c index 380d370..e6fbec8 100644 --- a/src/status.c +++ b/src/status.c @@ -37,6 +37,12 @@ zix_strerror(const ZixStatus status) return "Unknown error"; } +ZixStatus +zix_errno_status_if(const int r) +{ + return r ? zix_errno_status(errno) : ZIX_STATUS_SUCCESS; +} + ZixStatus zix_errno_status(const int e) { -- cgit v1.2.1