Drop the _t suffix as it is a POSIX reserved namespace
[libgit2.git] / src / git_common.h
blobc9c7b0e147c44682c9d4a100dce290c14762ff85
1 /*
2 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or
5 * without modification, are permitted provided that the following
6 * conditions are met:
8 * - Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials provided
14 * with the distribution.
16 * - Neither the name of the Git Development Community nor the
17 * names of its contributors may be used to endorse or promote
18 * products derived from this software without specific prior
19 * written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
22 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
26 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
30 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #ifndef INCLUDE_git_common_h__
37 #define INCLUDE_git_common_h__
39 #ifdef __cplusplus
40 # define GIT_BEGIN_DECL extern "C" {
41 # define GIT_END_DECL }
42 #else
43 /** Start declarations in C mode */
44 # define GIT_BEGIN_DECL /* empty */
45 /** End declarations in C mode */
46 # define GIT_END_DECL /* empty */
47 #endif
49 /**
50 * @file git_common.h
51 * @brief Git common platform definitions
52 * @defgroup git_common Git common platform definitions
53 * @ingroup Git
54 * @{
56 GIT_BEGIN_DECL
58 /** Declare a public function exported for application use. */
59 #ifdef __GNUC__
60 # define GIT_EXTERN(type) __attribute__((visibility("default"))) type
61 #else
62 # define GIT_EXTERN(type) type
63 #endif
65 /** Operation completed successfully. */
66 #define GIT_SUCCESS 0
68 /**
69 * Operation failed, with unspecified reason.
70 * This value also serves as the base error code; all other
71 * error codes are subtracted from it such that all errors
72 * are < 0, in typical POSIX C tradition.
74 #define GIT_ERROR -1
76 /** Input was not a properly formatted Git object id. */
77 #define GIT_ENOTOID (GIT_ERROR - 1)
79 /** Input does not exist in the scope searched. */
80 #define GIT_ENOTFOUND (GIT_ERROR - 2)
82 /** A revision traversal pool. */
83 typedef struct git_revp git_revp;
85 /** @} */
86 GIT_END_DECL
87 #endif