]>
Commit | Line | Data |
---|---|---|
f5918330 VM |
1 | /* |
2 | * This file is free software; you can redistribute it and/or modify | |
3 | * it under the terms of the GNU General Public License, version 2, | |
4 | * as published by the Free Software Foundation. | |
5 | * | |
6 | * In addition to the permissions in the GNU General Public License, | |
7 | * the authors give you unlimited permission to link the compiled | |
8 | * version of this file into combinations with other programs, | |
9 | * and to distribute those combinations without any restriction | |
10 | * coming from the use of this file. (The General Public License | |
11 | * restrictions do apply in other respects; for example, they cover | |
12 | * modification of the file, and distribution when not linked into | |
13 | * a combined executable.) | |
14 | * | |
15 | * This file is distributed in the hope that it will be useful, but | |
16 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
18 | * General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; see the file COPYING. If not, write to | |
22 | * the Free Software Foundation, 51 Franklin Street, Fifth Floor, | |
23 | * Boston, MA 02110-1301, USA. | |
24 | */ | |
c15648cb SP |
25 | #ifndef INCLUDE_git_common_h__ |
26 | #define INCLUDE_git_common_h__ | |
27 | ||
e3fe32b6 | 28 | #include "thread-utils.h" |
58519018 | 29 | #include <time.h> |
00571828 | 30 | #include <stdlib.h> |
e3fe32b6 | 31 | |
c15648cb SP |
32 | #ifdef __cplusplus |
33 | # define GIT_BEGIN_DECL extern "C" { | |
34 | # define GIT_END_DECL } | |
35 | #else | |
36 | /** Start declarations in C mode */ | |
37 | # define GIT_BEGIN_DECL /* empty */ | |
38 | /** End declarations in C mode */ | |
39 | # define GIT_END_DECL /* empty */ | |
40 | #endif | |
41 | ||
16a67770 SP |
42 | /** Declare a public function exported for application use. */ |
43 | #ifdef __GNUC__ | |
3b8ab0b9 | 44 | # define GIT_EXTERN(type) extern \ |
1e5dd572 RJ |
45 | __attribute__((visibility("default"))) \ |
46 | type | |
25e9b4dd VM |
47 | #elif defined(_MSC_VER) |
48 | # define GIT_EXTERN(type) __declspec(dllexport) type | |
16a67770 | 49 | #else |
3b8ab0b9 | 50 | # define GIT_EXTERN(type) extern type |
16a67770 SP |
51 | #endif |
52 | ||
e3fe32b6 RJ |
53 | /** Declare a public TLS symbol exported for application use. */ |
54 | #ifdef __GNUC__ | |
55 | # define GIT_EXTERN_TLS(type) extern \ | |
1e5dd572 RJ |
56 | __attribute__((visibility("default"))) \ |
57 | GIT_TLS \ | |
58 | type | |
11f6646f VM |
59 | #elif defined(_MSC_VER) |
60 | # define GIT_EXTERN_TLS(type) __declspec(dllexport) GIT_TLS type | |
e3fe32b6 RJ |
61 | #else |
62 | # define GIT_EXTERN_TLS(type) extern GIT_TLS type | |
63 | #endif | |
64 | ||
b7c891c6 | 65 | /** Declare a function as always inlined. */ |
8a086f87 RJ |
66 | #if defined(_MSC_VER) |
67 | # define GIT_INLINE(type) static __inline type | |
68 | #else | |
b7c891c6 | 69 | # define GIT_INLINE(type) static inline type |
8a086f87 | 70 | #endif |
b7c891c6 | 71 | |
15bffce9 SP |
72 | /** Declare a function's takes printf style arguments. */ |
73 | #ifdef __GNUC__ | |
74 | # define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b))) | |
75 | #else | |
76 | # define GIT_FORMAT_PRINTF(a,b) /* empty */ | |
77 | #endif | |
78 | ||
0657e46d RG |
79 | #if defined(_WIN32) && !defined(__CYGWIN__) |
80 | #define GIT_WIN32 1 | |
81 | #endif | |
82 | ||
c15648cb | 83 | /** |
f5918330 | 84 | * @file git2/common.h |
c15648cb SP |
85 | * @brief Git common platform definitions |
86 | * @defgroup git_common Git common platform definitions | |
87 | * @ingroup Git | |
88 | * @{ | |
89 | */ | |
c15648cb | 90 | |
16a67770 | 91 | GIT_BEGIN_DECL |
00571828 | 92 | |
0657e46d RG |
93 | /** |
94 | * The separator used in path list strings (ie like in the PATH | |
95 | * environment variable). A semi-colon ";" is used on Windows, and | |
96 | * a colon ":" for all other systems. | |
97 | */ | |
98 | #ifdef GIT_WIN32 | |
99 | #define GIT_PATH_LIST_SEPARATOR ';' | |
100 | #else | |
101 | #define GIT_PATH_LIST_SEPARATOR ':' | |
102 | #endif | |
103 | ||
104 | /** | |
105 | * The maximum length of a git valid git path. | |
106 | */ | |
107 | #define GIT_PATH_MAX 4096 | |
108 | ||
00571828 VM |
109 | typedef struct { |
110 | char **strings; | |
111 | size_t count; | |
112 | } git_strarray; | |
113 | ||
955f9ae9 | 114 | GIT_EXTERN(void) git_strarray_free(git_strarray *array); |
00571828 | 115 | |
536955f9 VM |
116 | /** |
117 | * Return the version of the libgit2 library | |
118 | * being currently used. | |
119 | * | |
120 | * @param major Store the major version number | |
121 | * @param minor Store the minor version number | |
122 | * @param rev Store the revision (patch) number | |
123 | */ | |
124 | GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev); | |
125 | ||
c15648cb SP |
126 | /** @} */ |
127 | GIT_END_DECL | |
128 | #endif |