]> git.proxmox.com Git - libgit2.git/blame - include/git/common.h
Create a micro abstraction around the POSIX file APIs
[libgit2.git] / include / git / common.h
CommitLineData
c15648cb 1/*
50298f44
SP
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.
c15648cb 5 *
50298f44
SP
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.)
c15648cb 14 *
50298f44
SP
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.
c15648cb 19 *
50298f44
SP
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.
c15648cb
SP
24 */
25
26#ifndef INCLUDE_git_common_h__
27#define INCLUDE_git_common_h__
28
29#ifdef __cplusplus
30# define GIT_BEGIN_DECL extern "C" {
31# define GIT_END_DECL }
32#else
33 /** Start declarations in C mode */
34# define GIT_BEGIN_DECL /* empty */
35 /** End declarations in C mode */
36# define GIT_END_DECL /* empty */
37#endif
38
16a67770
SP
39/** Declare a public function exported for application use. */
40#ifdef __GNUC__
41# define GIT_EXTERN(type) __attribute__((visibility("default"))) type
42#else
43# define GIT_EXTERN(type) type
44#endif
45
c15648cb 46/**
d1ea30c3 47 * @file git/common.h
c15648cb
SP
48 * @brief Git common platform definitions
49 * @defgroup git_common Git common platform definitions
50 * @ingroup Git
51 * @{
52 */
c15648cb 53
c15648cb
SP
54/** Operation completed successfully. */
55#define GIT_SUCCESS 0
56
57/**
58 * Operation failed, with unspecified reason.
59 * This value also serves as the base error code; all other
60 * error codes are subtracted from it such that all errors
61 * are < 0, in typical POSIX C tradition.
62 */
63#define GIT_ERROR -1
64
65/** Input was not a properly formatted Git object id. */
66#define GIT_ENOTOID (GIT_ERROR - 1)
67
68/** Input does not exist in the scope searched. */
69#define GIT_ENOTFOUND (GIT_ERROR - 2)
70
16a67770
SP
71#include "git/config.h"
72
73GIT_BEGIN_DECL
74
06160502 75/** A revision traversal pool. */
6533aadc 76typedef struct git_revp git_revp;
06160502 77
c15648cb
SP
78/** @} */
79GIT_END_DECL
80#endif