]> git.proxmox.com Git - libgit2.git/blob - src/common.h
Merge pull request #397 from lambourg/development
[libgit2.git] / src / common.h
1 /*
2 * Copyright (C) 2009-2011 the libgit2 contributors
3 *
4 * This file is part of libgit2, distributed under the GNU GPL v2 with
5 * a Linking Exception. For full terms see the included COPYING file.
6 */
7 #ifndef INCLUDE_common_h__
8 #define INCLUDE_common_h__
9
10 #include "git2/common.h"
11 #include "git2/thread-utils.h"
12 #include "cc-compat.h"
13
14 #ifdef GIT_HAVE_INTTYPES_H
15 # include <inttypes.h>
16 #endif
17 #include <assert.h>
18 #include <errno.h>
19 #include <limits.h>
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <string.h>
23
24 #include <sys/types.h>
25 #include <sys/stat.h>
26
27 #ifdef GIT_WIN32
28
29 # include <io.h>
30 # include <direct.h>
31 # include <windows.h>
32 # include "win32/msvc-compat.h"
33 # include "win32/mingw-compat.h"
34 # ifdef GIT_THREADS
35 # include "win32/pthread.h"
36 #endif
37
38 # define snprintf _snprintf
39
40 #ifndef _SSIZE_T_DEFINED
41 typedef SSIZE_T ssize_t;
42 #endif
43
44 #else
45 # include <unistd.h>
46
47 # ifdef GIT_THREADS
48 # include <pthread.h>
49 # endif
50 #endif
51
52 #include "git2/types.h"
53 #include "git2/errors.h"
54 #include "thread-utils.h"
55 #include "bswap.h"
56
57 extern void git___throw(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
58 #define git__throw(error, ...) \
59 (git___throw(__VA_ARGS__), error)
60
61 extern void git___rethrow(const char *, ...) GIT_FORMAT_PRINTF(1, 2);
62 #define git__rethrow(error, ...) \
63 (git___rethrow(__VA_ARGS__), error)
64
65 #include "util.h"
66
67 #endif /* INCLUDE_common_h__ */