examples: consolidate includes into "common.h"

Consolidate all standard includes and defines into "common.h". This lets
us avoid having to handle platform-specific things in multiple places.
This commit is contained in:
Patrick Steinhardt
2019-07-05 14:30:48 +02:00
parent 3be09b6c02
commit 960d2a070f
5 changed files with 18 additions and 26 deletions

View File

@@ -12,10 +12,25 @@
* <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <git2.h>
#include <fcntl.h>
#ifdef _WIN32
# include <io.h>
# include <Windows.h>
# define open _open
# define read _read
# define close _close
# define ssize_t int
# define sleep(a) Sleep(a * 1000)
#else
# include <unistd.h>
#endif
#ifndef PRIuZ
/* Define the printf format specifer to use for size_t output */