提交 c01a1426 authored 作者: Travis Cross's avatar Travis Cross

Implement su_errno and su_seterrno as functions

This avoid warnings about expressions with unused values.  These
warnings break the build with clang.

An optimizing compiler should still inline these calls.  If that turns
out not to happen on some platform, we could rename the functions used
internally and declare them static inline.
上级 43f2c89a
...@@ -53,11 +53,6 @@ SOFIAPUBFUN int su_errno(void); ...@@ -53,11 +53,6 @@ SOFIAPUBFUN int su_errno(void);
/** Set the su error. */ /** Set the su error. */
SOFIAPUBFUN int su_seterrno(int); SOFIAPUBFUN int su_seterrno(int);
#if !SU_HAVE_WINSOCK
#define su_errno() (errno)
#define su_seterrno(n) ((errno = (n)), -1)
#endif
#if defined(__APPLE_CC__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__APPLE_CC__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#ifndef EBADMSG #ifndef EBADMSG
#define EBADMSG EFAULT #define EBADMSG EFAULT
......
...@@ -157,4 +157,7 @@ const char *su_strerror(int errcode) ...@@ -157,4 +157,7 @@ const char *su_strerror(int errcode)
return strerror(errcode); return strerror(errcode);
} }
int su_errno(void) { return errno; }
int su_seterrno(int n) { errno = n; return -1; }
#endif /* SU_HAVE_WINSOCK */ #endif /* SU_HAVE_WINSOCK */
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论