]> git.proxmox.com Git - libgit2.git/blame - include/git2/common.h
Update Copyright header
[libgit2.git] / include / git2 / common.h
CommitLineData
f5918330 1/*
5e0de328 2 * Copyright (C) 2009-2012 the libgit2 contributors
f5918330 3 *
bb742ede
VM
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.
f5918330 6 */
c15648cb
SP
7#ifndef INCLUDE_git_common_h__
8#define INCLUDE_git_common_h__
9
58519018 10#include <time.h>
00571828 11#include <stdlib.h>
e3fe32b6 12
c060854e
VM
13#ifdef _MSC_VER
14# include "inttypes.h"
15#else
16# include <inttypes.h>
17#endif
18
c15648cb 19#ifdef __cplusplus
87d9869f
VM
20# define GIT_BEGIN_DECL extern "C" {
21# define GIT_END_DECL }
c15648cb 22#else
87d9869f
VM
23 /** Start declarations in C mode */
24# define GIT_BEGIN_DECL /* empty */
25 /** End declarations in C mode */
26# define GIT_END_DECL /* empty */
c15648cb
SP
27#endif
28
16a67770 29/** Declare a public function exported for application use. */
d2a1861e 30#if __GNUC__ >= 4
3b8ab0b9 31# define GIT_EXTERN(type) extern \
87d9869f
VM
32 __attribute__((visibility("default"))) \
33 type
25e9b4dd
VM
34#elif defined(_MSC_VER)
35# define GIT_EXTERN(type) __declspec(dllexport) type
16a67770 36#else
3b8ab0b9 37# define GIT_EXTERN(type) extern type
16a67770
SP
38#endif
39
b7c891c6 40/** Declare a function as always inlined. */
8a086f87
RJ
41#if defined(_MSC_VER)
42# define GIT_INLINE(type) static __inline type
43#else
b7c891c6 44# define GIT_INLINE(type) static inline type
8a086f87 45#endif
b7c891c6 46
15bffce9
SP
47/** Declare a function's takes printf style arguments. */
48#ifdef __GNUC__
49# define GIT_FORMAT_PRINTF(a,b) __attribute__((format (printf, a, b)))
50#else
51# define GIT_FORMAT_PRINTF(a,b) /* empty */
52#endif
53
314f54eb 54#if (defined(_WIN32) || defined(_WIN64)) && !defined(__CYGWIN__)
0657e46d
RG
55#define GIT_WIN32 1
56#endif
57
c15648cb 58/**
f5918330 59 * @file git2/common.h
c15648cb
SP
60 * @brief Git common platform definitions
61 * @defgroup git_common Git common platform definitions
62 * @ingroup Git
63 * @{
64 */
c15648cb 65
16a67770 66GIT_BEGIN_DECL
00571828 67
0657e46d
RG
68/**
69 * The separator used in path list strings (ie like in the PATH
70 * environment variable). A semi-colon ";" is used on Windows, and
71 * a colon ":" for all other systems.
72 */
73#ifdef GIT_WIN32
74#define GIT_PATH_LIST_SEPARATOR ';'
75#else
76#define GIT_PATH_LIST_SEPARATOR ':'
77#endif
78
79/**
80 * The maximum length of a git valid git path.
81 */
82#define GIT_PATH_MAX 4096
83
00571828
VM
84typedef struct {
85 char **strings;
86 size_t count;
87} git_strarray;
88
955f9ae9 89GIT_EXTERN(void) git_strarray_free(git_strarray *array);
00571828 90
536955f9
VM
91/**
92 * Return the version of the libgit2 library
93 * being currently used.
94 *
95 * @param major Store the major version number
96 * @param minor Store the minor version number
97 * @param rev Store the revision (patch) number
98 */
99GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
100
c15648cb
SP
101/** @} */
102GIT_END_DECL
103#endif