diff --git a/src/git_common.h b/src/git_common.h index f9fce2b42..f5121b1e6 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 290ba2a03..13de54b92 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 dab2ff4ba..ecb100a9c 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 d0a44bd6e..fd899f459 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 5ec2b329a..30c62a2d5 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