mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
introduce uppercase macros SOCKERRNO, SET_SOCKERRNO(), ERRNO and SET_ERRNO()
making them available to any source code file which includes "setup.h". Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno (or equivalent) on this platform to hide platform details to code using it. Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno (or equivalent) on this platform to hide platform details to code using it.
This commit is contained in:
parent
d381dd68cf
commit
d21e4eb8ae
@ -158,5 +158,33 @@ typedef int sig_atomic_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
||||||
|
* (or equivalent) on this platform to hide platform details to code using it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_WINSOCK
|
||||||
|
#define SOCKERRNO ((int)WSAGetLastError())
|
||||||
|
#define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
|
||||||
|
#else
|
||||||
|
#define SOCKERRNO (errno)
|
||||||
|
#define SET_SOCKERRNO(x) (errno = (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
|
||||||
|
* (or equivalent) on this platform to hide platform details to code using it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define ERRNO ((int)GetLastError())
|
||||||
|
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
|
||||||
|
#else
|
||||||
|
#define ERRNO (errno)
|
||||||
|
#define SET_ERRNO(x) (errno = (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SETUP_ONCE_H */
|
#endif /* __SETUP_ONCE_H */
|
||||||
|
|
||||||
|
@ -165,5 +165,33 @@ typedef int sig_atomic_t;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro SOCKERRNO / SET_SOCKERRNO() returns / sets the *socket-related* errno
|
||||||
|
* (or equivalent) on this platform to hide platform details to code using it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef USE_WINSOCK
|
||||||
|
#define SOCKERRNO ((int)WSAGetLastError())
|
||||||
|
#define SET_SOCKERRNO(x) (WSASetLastError((int)(x)))
|
||||||
|
#else
|
||||||
|
#define SOCKERRNO (errno)
|
||||||
|
#define SET_SOCKERRNO(x) (errno = (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Macro ERRNO / SET_ERRNO() returns / sets the NOT *socket-related* errno
|
||||||
|
* (or equivalent) on this platform to hide platform details to code using it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define ERRNO ((int)GetLastError())
|
||||||
|
#define SET_ERRNO(x) (SetLastError((DWORD)(x)))
|
||||||
|
#else
|
||||||
|
#define ERRNO (errno)
|
||||||
|
#define SET_ERRNO(x) (errno = (x))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* __SETUP_ONCE_H */
|
#endif /* __SETUP_ONCE_H */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user