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.
This commit is contained in:
Travis Cross
2012-06-25 05:29:39 +00:00
parent 43f2c89a08
commit c01a142665
2 changed files with 3 additions and 5 deletions
@@ -53,11 +53,6 @@ SOFIAPUBFUN int su_errno(void);
/** Set the su error. */
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__)
#ifndef EBADMSG
#define EBADMSG EFAULT
@@ -157,4 +157,7 @@ const char *su_strerror(int errcode)
return strerror(errcode);
}
int su_errno(void) { return errno; }
int su_seterrno(int n) { errno = n; return -1; }
#endif /* SU_HAVE_WINSOCK */