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 --- include/zix/common.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/zix/common.h b/include/zix/common.h index a097edd..59a61ac 100644 --- a/include/zix/common.h +++ b/include/zix/common.h @@ -42,6 +42,11 @@ ZIX_CONST_API ZixStatus zix_errno_status(int e); +/// Return success if `r` is non-zero, or `errno` as a status code otherwise +ZIX_PURE_API +ZixStatus +zix_errno_status_if(int r); + /// Function for comparing two elements typedef int (*ZixComparator)(const void* a, const void* b, -- cgit v1.2.1