Luna/libc/include/bits/errno-return.h
apio b70bbc0ba6
All checks were successful
continuous-integration/drone/push Build is passing
More libc commenting
2023-01-07 11:21:53 +01:00

19 lines
1.1 KiB
C

/* bits/errno-return.h: Provides a convenient way of setting errno after a syscall. */
#ifndef _BITS_ERRNO_RETURN_H
#define _BITS_ERRNO_RETURN_H
#include <errno.h>
#define __errno_return(value, type) \
do { \
if (value < 0) \
{ \
errno = (int)(-value); \
return (type)-1; \
} \
return (type)value; \
} while (0)
#endif