Add _t suffix to all data types Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
diff --git a/src/git_common.h b/src/git_common.h
index f9fce2b..f5121b1 100644
--- a/src/git_common.h
+++ b/src/git_common.h
@@ -59,7 +59,7 @@ GIT_BEGIN_DECL
#define GIT_EXTERN(type) type
/** Generic result code for any API call. */
-typedef int git_result;
+typedef int git_result_t;
/** Operation completed successfully. */
#define GIT_SUCCESS 0
diff --git a/src/git_odb.c b/src/git_odb.c
index 290ba2a..13de54b 100644
--- a/src/git_odb.c
+++ b/src/git_odb.c
@@ -35,18 +35,21 @@
#include "git_odb.h"
-struct git_odb {
+struct git_odb_t {
/** Path to the "objects" directory. */
const char *path;
/** Alternate databases to search. */
- struct git_odb **alternates;
+ git_odb_t **alternates;
/** Number of alternates available. */
unsigned n_alternates;
};
-git_result git_odb_read(git_sobj *out, git_odb *db, const git_oid *id)
+git_result_t git_odb_read(
+ git_sobj_t *out,
+ git_odb_t *db,
+ const git_oid_t *id)
{
if (!git_odb__read_packed(out, db, id))
return GIT_SUCCESS;
diff --git a/src/git_odb.h b/src/git_odb.h
index dab2ff4..ecb100a 100644
--- a/src/git_odb.h
+++ b/src/git_odb.h
@@ -43,14 +43,14 @@
/**
* @file git_odb.h
* @brief Git object database routines
- * @defgroup git_odb Git object database routines
+ * @defgroup git_odb_t Git object database routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
/** An open object database handle. */
-typedef struct git_odb git_odb;
+typedef struct git_odb_t git_odb_t;
/**
* Open an object database for read/write access.
@@ -60,14 +60,14 @@ typedef struct git_odb git_odb;
* @return GIT_SUCCESS if the database opened; otherwise an error
* code describing why the open was not possible.
*/
-GIT_EXTERN(git_result) git_odb_open(git_odb **out, const char *objects_dir);
+GIT_EXTERN(git_result_t) git_odb_open(git_odb_t **out, const char *objects_dir);
/**
* Close an open object database.
* @param db database pointer to close. If NULL no action is taken.
* The pointer is set to NULL when the close is completed.
*/
-GIT_EXTERN(void) git_odb_close(git_odb** db);
+GIT_EXTERN(void) git_odb_close(git_odb_t **db);
/** Basic type (loose or packed) of any Git object. */
typedef enum {
@@ -80,14 +80,14 @@ typedef enum {
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
-} git_otype;
+} git_otype_t;
/** A small object read from the database. */
typedef struct {
- void *data; /**< Raw, decompressed object data. */
- size_t len; /**< Total number of bytes in data. */
- git_otype type; /**< Type of this object. */
-} git_sobj;
+ void *data; /**< Raw, decompressed object data. */
+ size_t len ; /**< Total number of bytes in data. */
+ git_otype_t type; /**< Type of this object. */
+} git_sobj_t;
/**
* Read a small object from the database.
@@ -101,7 +101,7 @@ typedef struct {
* - GIT_SUCCESS if the object was read;
* - GIT_ENOTFOUND if the object is not in the database.
*/
-GIT_EXTERN(git_result) git_odb_read(git_sobj *out, git_odb *db, const git_oid *id);
+GIT_EXTERN(git_result_t) git_odb_read(git_sobj_t *out, git_odb_t *db, const git_oid_t *id);
/**
* Read a small object from the database using only pack files.
@@ -115,7 +115,7 @@ GIT_EXTERN(git_result) git_odb_read(git_sobj *out, git_odb *db, const git_oid *i
* - GIT_SUCCESS if the object was read.
* - GIT_ENOTFOUND if the object is not in the database.
*/
-GIT_EXTERN(git_result) git_odb__read_packed(git_sobj *out, git_odb *db, const git_oid *id);
+GIT_EXTERN(git_result_t) git_odb__read_packed(git_sobj_t *out, git_odb_t *db, const git_oid_t *id);
/**
* Read a small object from the database using only loose object files.
@@ -129,7 +129,7 @@ GIT_EXTERN(git_result) git_odb__read_packed(git_sobj *out, git_odb *db, const gi
* - GIT_SUCCESS if the object was read.
* - GIT_ENOTFOUND if the object is not in the database.
*/
-GIT_EXTERN(git_result) git_odb__read_loose(git_sobj *out, git_odb *db, const git_oid *id);
+GIT_EXTERN(git_result_t) git_odb__read_loose(git_sobj_t *out, git_odb_t *db, const git_oid_t *id);
/**
* Release all memory used by the sobj structure.
@@ -140,7 +140,7 @@ GIT_EXTERN(git_result) git_odb__read_loose(git_sobj *out, git_odb *db, const git
*
* @param obj object descriptor to free.
*/
-GIT_EXTERN(void) git_sobj_close(git_sobj *obj);
+GIT_EXTERN(void) git_sobj_close(git_sobj_t *obj);
/** @} */
GIT_END_DECL
diff --git a/src/git_oid.c b/src/git_oid.c
index d0a44bd..fd899f4 100644
--- a/src/git_oid.c
+++ b/src/git_oid.c
@@ -55,7 +55,7 @@ static signed char from_hex[] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /* f0 */
};
-git_result git_oid_mkstr(git_oid *out, const char *str)
+git_result_t git_oid_mkstr(git_oid_t *out, const char *str)
{
int p;
for (p = 0; p < sizeof(out->id); p++, str += 2) {
@@ -67,7 +67,7 @@ git_result git_oid_mkstr(git_oid *out, const char *str)
return GIT_SUCCESS;
}
-void git_oid_mkraw(git_oid *out, const unsigned char *raw)
+void git_oid_mkraw(git_oid_t *out, const unsigned char *raw)
{
memcpy(out->id, raw, sizeof(out->id));
}
diff --git a/src/git_oid.h b/src/git_oid.h
index 5ec2b32..30c62a2 100644
--- a/src/git_oid.h
+++ b/src/git_oid.h
@@ -52,7 +52,7 @@ typedef struct
{
/** raw binary formatted id */
unsigned char id[20];
-} git_oid;
+} git_oid_t;
/**
* Parse a hex formatted object id into a git_oid.
@@ -62,14 +62,14 @@ typedef struct
* needed for an oid encoded in hex (40 bytes).
* @return GIT_SUCCESS if valid; GIT_ENOTOID on failure.
*/
-GIT_EXTERN(git_result) git_oid_mkstr(git_oid *out, const char *str);
+GIT_EXTERN(git_result_t) git_oid_mkstr(git_oid_t *out, const char *str);
/**
* Copy an already raw oid into a git_oid structure.
* @param out oid structure the result is written into.
* @param raw the raw input bytes to be copied.
*/
-GIT_EXTERN(void) git_oid_mkraw(git_oid *out, const unsigned char *raw);
+GIT_EXTERN(void) git_oid_mkraw(git_oid_t *out, const unsigned char *raw);
/** @} */
GIT_END_DECL