Regroup Windows-ifdefs in command.h

master
Romain Vimont 7 years ago
parent 477c0a2cab
commit 6c40dbd27d

@ -3,33 +3,33 @@
#include <inttypes.h> #include <inttypes.h>
#include <SDL2/SDL_stdinc.h> #include <SDL2/SDL_stdinc.h>
#include <SDL2/SDL_platform.h>
// <https://stackoverflow.com/a/44383330/1987178>
#ifdef _WIN32 #ifdef _WIN32
# include <winsock2.h> // not needed here, but must never be included AFTER windows.h
# include <windows.h>
# define PRIexitcode "lu" # define PRIexitcode "lu"
// <https://stackoverflow.com/a/44383330/1987178>
# ifdef _WIN64 # ifdef _WIN64
# define PRIsizet PRIu64 # define PRIsizet PRIu64
# else # else
# define PRIsizet PRIu32 # define PRIsizet PRIu32
# endif # endif
#else
# define PRIsizet "zu"
# define PRIexitcode "d"
#endif
#ifdef __WINDOWS__
# include <winsock2.h> // not needed here, but must never be included AFTER windows.h
# include <windows.h>
# define PROCESS_NONE NULL # define PROCESS_NONE NULL
typedef HANDLE process_t; typedef HANDLE process_t;
typedef DWORD exit_code_t; typedef DWORD exit_code_t;
#else #else
# include <sys/types.h> # include <sys/types.h>
# define PRIsizet "zu"
# define PRIexitcode "d"
# define PROCESS_NONE -1 # define PROCESS_NONE -1
typedef pid_t process_t; typedef pid_t process_t;
typedef int exit_code_t; typedef int exit_code_t;
#endif #endif
# define NO_EXIT_CODE -1 # define NO_EXIT_CODE -1
enum process_result { enum process_result {

Loading…
Cancel
Save