1
0
Fork 0

refactor: rename UNIX_ENABLED to POSIX_ENABLED

This commit is contained in:
Thomas Touhey 2024-04-02 12:24:25 +02:00
parent 732e2ef025
commit 0c5a88c192
3 changed files with 16 additions and 14 deletions

View File

@ -28,7 +28,7 @@
#include "internals.h"
#if UNIX_ENABLED
#if POSIX_ENABLED
# include <dirent.h>
/**
@ -76,7 +76,7 @@ cahute_detect_serial(
cahute_detect_serial_entry_func CAHUTE_NNPTR(func),
void *cookie
) CAHUTE_NONNULL(1) {
#if UNIX_ENABLED
#if POSIX_ENABLED
DIR *dp;
struct dirent *dr;
struct stat st;

View File

@ -43,15 +43,15 @@
#endif
#if WINDOWS_ENABLED
# define UNIX_ENABLED 0
# define POSIX_ENABLED 0
#elif defined(__unix__) && __unix__ \
|| (defined(__APPLE__) || defined(__MACH__))
# define UNIX_ENABLED 1
# define POSIX_ENABLED 1
#else
# define UNIX_ENABLED 0
# define POSIX_ENABLED 0
#endif
#if UNIX_ENABLED
#if POSIX_ENABLED
# include <fcntl.h>
# include <sys/ioctl.h>
# include <sys/stat.h>
@ -163,7 +163,7 @@ CAHUTE_INLINE(void) log_windows_error(char const *func_name, DWORD code) {
#define CAHUTE_LINK_FLAG_IRRECOVERABLE 0x00000400 /* Cannot recover. */
/* Medium types allowed. */
#if UNIX_ENABLED
#if POSIX_ENABLED
# define CAHUTE_LINK_MEDIUM_POSIX_SERIAL 1
#endif
#if WINDOWS_ENABLED
@ -190,7 +190,7 @@ CAHUTE_INLINE(void) log_windows_error(char const *func_name, DWORD code) {
#define CAHUTE_CASIOLINK_VARIANT_CAS50 2
#define CAHUTE_CASIOLINK_VARIANT_CAS100 3
#if UNIX_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_POSIX_SERIAL)
/**
* POSIX medium state.
*
@ -201,7 +201,8 @@ struct cahute_link_posix_medium_state {
};
#endif
#if WINDOWS_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_WIN32_SERIAL) \
|| defined(CAHUTE_LINK_MEDIUM_WIN32_CESG)
/**
* Windows API medium state.
*
@ -212,7 +213,7 @@ struct cahute_link_windows_medium_state {
};
#endif
#if LIBUSB_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_LIBUSB)
/**
* libusb device medium state.
*
@ -238,13 +239,14 @@ struct cahute_link_libusb_medium_state {
* @property libusb Medium state if the selected medium type is LIBUSB.
*/
union cahute_link_medium_state {
#if UNIX_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_POSIX_SERIAL)
struct cahute_link_posix_medium_state posix;
#endif
#if WINDOWS_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_WIN32_SERIAL) \
|| defined(CAHUTE_LINK_MEDIUM_WIN32_CESG)
struct cahute_link_windows_medium_state windows;
#endif
#if LIBUSB_ENABLED
#if defined(CAHUTE_LINK_MEDIUM_LIBUSB)
struct cahute_link_libusb_medium_state libusb;
#endif
};

View File

@ -41,7 +41,7 @@ CAHUTE_EXTERN(int) cahute_monotonic(unsigned long *msp) {
return CAHUTE_OK;
}
#elif UNIX_ENABLED
#elif POSIX_ENABLED
# include <unistd.h>
# include <time.h>