Commit 29f0e90f by Shawn O. Pearce

Add _t suffix to all data types

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
parent bce499af
...@@ -59,7 +59,7 @@ GIT_BEGIN_DECL ...@@ -59,7 +59,7 @@ GIT_BEGIN_DECL
#define GIT_EXTERN(type) type #define GIT_EXTERN(type) type
/** Generic result code for any API call. */ /** Generic result code for any API call. */
typedef int git_result; typedef int git_result_t;
/** Operation completed successfully. */ /** Operation completed successfully. */
#define GIT_SUCCESS 0 #define GIT_SUCCESS 0
......
...@@ -35,18 +35,21 @@ ...@@ -35,18 +35,21 @@
#include "git_odb.h" #include "git_odb.h"
struct git_odb { struct git_odb_t {
/** Path to the "objects" directory. */ /** Path to the "objects" directory. */
const char *path; const char *path;
/** Alternate databases to search. */ /** Alternate databases to search. */
struct git_odb **alternates; git_odb_t **alternates;
/** Number of alternates available. */ /** Number of alternates available. */
unsigned n_alternates; 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)) if (!git_odb__read_packed(out, db, id))
return GIT_SUCCESS; return GIT_SUCCESS;
......
...@@ -43,14 +43,14 @@ ...@@ -43,14 +43,14 @@
/** /**
* @file git_odb.h * @file git_odb.h
* @brief Git object database routines * @brief Git object database routines
* @defgroup git_odb Git object database routines * @defgroup git_odb_t Git object database routines
* @ingroup Git * @ingroup Git
* @{ * @{
*/ */
GIT_BEGIN_DECL GIT_BEGIN_DECL
/** An open object database handle. */ /** 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. * Open an object database for read/write access.
...@@ -60,14 +60,14 @@ typedef struct git_odb git_odb; ...@@ -60,14 +60,14 @@ typedef struct git_odb git_odb;
* @return GIT_SUCCESS if the database opened; otherwise an error * @return GIT_SUCCESS if the database opened; otherwise an error
* code describing why the open was not possible. * 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. * Close an open object database.
* @param db database pointer to close. If NULL no action is taken. * @param db database pointer to close. If NULL no action is taken.
* The pointer is set to NULL when the close is completed. * 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. */ /** Basic type (loose or packed) of any Git object. */
typedef enum { typedef enum {
...@@ -80,14 +80,14 @@ typedef enum { ...@@ -80,14 +80,14 @@ typedef enum {
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */ GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */ 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_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
} git_otype; } git_otype_t;
/** A small object read from the database. */ /** A small object read from the database. */
typedef struct { typedef struct {
void *data; /**< Raw, decompressed object data. */ void *data; /**< Raw, decompressed object data. */
size_t len; /**< Total number of bytes in data. */ size_t len ; /**< Total number of bytes in data. */
git_otype type; /**< Type of this object. */ git_otype_t type; /**< Type of this object. */
} git_sobj; } git_sobj_t;
/** /**
* Read a small object from the database. * Read a small object from the database.
...@@ -101,7 +101,7 @@ typedef struct { ...@@ -101,7 +101,7 @@ typedef struct {
* - GIT_SUCCESS if the object was read; * - GIT_SUCCESS if the object was read;
* - GIT_ENOTFOUND if the object is not in the database. * - 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. * 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 ...@@ -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_SUCCESS if the object was read.
* - GIT_ENOTFOUND if the object is not in the database. * - 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. * 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 ...@@ -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_SUCCESS if the object was read.
* - GIT_ENOTFOUND if the object is not in the database. * - 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. * 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 ...@@ -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. * @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 GIT_END_DECL
......
...@@ -55,7 +55,7 @@ static signed char from_hex[] = { ...@@ -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 */ -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; int p;
for (p = 0; p < sizeof(out->id); p++, str += 2) { 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) ...@@ -67,7 +67,7 @@ git_result git_oid_mkstr(git_oid *out, const char *str)
return GIT_SUCCESS; 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)); memcpy(out->id, raw, sizeof(out->id));
} }
...@@ -52,7 +52,7 @@ typedef struct ...@@ -52,7 +52,7 @@ typedef struct
{ {
/** raw binary formatted id */ /** raw binary formatted id */
unsigned char id[20]; unsigned char id[20];
} git_oid; } git_oid_t;
/** /**
* Parse a hex formatted object id into a git_oid. * Parse a hex formatted object id into a git_oid.
...@@ -62,14 +62,14 @@ typedef struct ...@@ -62,14 +62,14 @@ typedef struct
* needed for an oid encoded in hex (40 bytes). * needed for an oid encoded in hex (40 bytes).
* @return GIT_SUCCESS if valid; GIT_ENOTOID on failure. * @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. * Copy an already raw oid into a git_oid structure.
* @param out oid structure the result is written into. * @param out oid structure the result is written into.
* @param raw the raw input bytes to be copied. * @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 GIT_END_DECL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment