common.h 1.33 KB
Newer Older
Vicent Marti committed
1 2 3 4 5 6
/*
 * Copyright (C) 2009-2011 the libgit2 contributors
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
7 8 9
#ifndef INCLUDE_common_h__
#define INCLUDE_common_h__

10
#include "git2/common.h"
11
#include "git2/thread-utils.h"
12
#include "cc-compat.h"
13

14 15 16
#ifdef GIT_HAVE_INTTYPES_H
# include <inttypes.h>
#endif
17
#include <assert.h>
18
#include <errno.h>
19
#include <limits.h>
20
#include <stdlib.h>
21
#include <stdio.h>
22 23
#include <string.h>

24
#include <sys/types.h>
25
#include <sys/stat.h>
26 27 28 29

#ifdef GIT_WIN32

# include <io.h>
30
# include <direct.h>
31
# include <windows.h>
32 33
# include "win32/msvc-compat.h"
# include "win32/mingw-compat.h"
Vicent Marti committed
34
# ifdef GIT_THREADS
Vicent Marti committed
35
#	include "win32/pthread.h"
Vicent Marti committed
36
#endif
37

38
# define snprintf _snprintf
39

40
#ifndef _SSIZE_T_DEFINED
41
typedef SSIZE_T ssize_t;
42
#endif
43

44 45 46
#else
# include <unistd.h>

Vicent Marti committed
47
# ifdef GIT_THREADS
Vicent Marti committed
48
#	include <pthread.h>
Vicent Marti committed
49
# endif
50 51
#endif

52
#include "git2/types.h"
53
#include "git2/errors.h"
54
#include "thread-utils.h"
55
#include "bswap.h"
56

57 58 59 60 61 62 63
extern void git___throw(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
#define git__throw(error, ...) \
	(git___throw(__VA_ARGS__), error)

extern void git___rethrow(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
#define git__rethrow(error, ...) \
	(git___rethrow(__VA_ARGS__), error)
64

65 66
#include "util.h"

67
#endif /* INCLUDE_common_h__ */