From d072adfbe40e15715e2065f1900f8d5a76491c5f Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 20 Oct 2022 21:34:20 -0400 Subject: Hide errno utility functions --- src/errno_status.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/errno_status.h (limited to 'src/errno_status.h') diff --git a/src/errno_status.h b/src/errno_status.h new file mode 100644 index 0000000..da26b66 --- /dev/null +++ b/src/errno_status.h @@ -0,0 +1,20 @@ +// Copyright 2022 David Robillard +// SPDX-License-Identifier: ISC + +#ifndef ZIX_ERRNO_STATUS_H +#define ZIX_ERRNO_STATUS_H + +#include "zix/attributes.h" +#include "zix/common.h" + +/// Return an errno value converted to a status code +ZIX_CONST_FUNC +ZixStatus +zix_errno_status(int e); + +/// Return success if `r` is non-zero, or `errno` as a status code otherwise +ZIX_PURE_FUNC +ZixStatus +zix_errno_status_if(int r); + +#endif // ZIX_ERRNO_STATUS_H -- cgit v1.2.1