]> git.proxmox.com Git - libgit2.git/blame - include/git2/common.h
pre-compiled sha1ppc.S.obj file with nasty CMake hack instructions as the cross-compi...
[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 34#elif defined(_MSC_VER)
79fdde49 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
c02f1392 54#if (defined(_WIN32)) && !defined(__CYGWIN__)
0657e46d
RG
55#define GIT_WIN32 1
56#endif
57
0f5e1f3b
CY
58#ifdef __amigaos4__
59/* Network byte order is big-endian... so is PPC, so these functions are NOP */
60#define htonl(x) x
61#define ntohl(x) x
62#define htons(x) x
63#define ntohs(x) x
64#endif
65
c15648cb 66/**
f5918330 67 * @file git2/common.h
c15648cb
SP
68 * @brief Git common platform definitions
69 * @defgroup git_common Git common platform definitions
70 * @ingroup Git
71 * @{
72 */
c15648cb 73
16a67770 74GIT_BEGIN_DECL
00571828 75
0657e46d
RG
76/**
77 * The separator used in path list strings (ie like in the PATH
78 * environment variable). A semi-colon ";" is used on Windows, and
79 * a colon ":" for all other systems.
80 */
81#ifdef GIT_WIN32
82#define GIT_PATH_LIST_SEPARATOR ';'
83#else
84#define GIT_PATH_LIST_SEPARATOR ':'
85#endif
86
87/**
b1ec25fa 88 * The maximum length of a valid git path.
0657e46d
RG
89 */
90#define GIT_PATH_MAX 4096
91
00571828
VM
92typedef struct {
93 char **strings;
94 size_t count;
95} git_strarray;
96
955f9ae9 97GIT_EXTERN(void) git_strarray_free(git_strarray *array);
14a513e0 98GIT_EXTERN(int) git_strarray_copy(git_strarray *tgt, const git_strarray *src);
00571828 99
536955f9
VM
100/**
101 * Return the version of the libgit2 library
102 * being currently used.
103 *
104 * @param major Store the major version number
105 * @param minor Store the minor version number
106 * @param rev Store the revision (patch) number
107 */
108GIT_EXTERN(void) git_libgit2_version(int *major, int *minor, int *rev);
109
fa56478f 110/* GIT_EXTERN(int) p_fnmatch(const char *pattern, const char *string, int flags); */
aa5a92d1 111
c15648cb
SP
112/** @} */
113GIT_END_DECL
114#endif