Commit bab92a8d by Carlos Martín Nieto

Merge pull request #2575 from cirosantilli/factor-struct-typedef

[factor] Join typedef and struct definitions in single file.
parents 942a7b39 06280457
...@@ -421,15 +421,14 @@ typedef int (*git_diff_file_cb)( ...@@ -421,15 +421,14 @@ typedef int (*git_diff_file_cb)(
/** /**
* Structure describing a hunk of a diff. * Structure describing a hunk of a diff.
*/ */
typedef struct git_diff_hunk git_diff_hunk; typedef struct git_diff_hunk {
struct git_diff_hunk {
int old_start; /**< Starting line number in old_file */ int old_start; /**< Starting line number in old_file */
int old_lines; /**< Number of lines in old_file */ int old_lines; /**< Number of lines in old_file */
int new_start; /**< Starting line number in new_file */ int new_start; /**< Starting line number in new_file */
int new_lines; /**< Number of lines in new_file */ int new_lines; /**< Number of lines in new_file */
size_t header_len; /**< Number of bytes in header text */ size_t header_len; /**< Number of bytes in header text */
char header[128]; /**< Header text, NUL-byte terminated */ char header[128]; /**< Header text, NUL-byte terminated */
}; } git_diff_hunk;
/** /**
* When iterating over a diff, callback that will be made per hunk. * When iterating over a diff, callback that will be made per hunk.
...@@ -469,8 +468,7 @@ typedef enum { ...@@ -469,8 +468,7 @@ typedef enum {
/** /**
* Structure describing a line (or data span) of a diff. * Structure describing a line (or data span) of a diff.
*/ */
typedef struct git_diff_line git_diff_line; typedef struct git_diff_line {
struct git_diff_line {
char origin; /**< A git_diff_line_t value */ char origin; /**< A git_diff_line_t value */
int old_lineno; /**< Line number in old file or -1 for added line */ int old_lineno; /**< Line number in old file or -1 for added line */
int new_lineno; /**< Line number in new file or -1 for deleted line */ int new_lineno; /**< Line number in new file or -1 for deleted line */
...@@ -478,7 +476,7 @@ struct git_diff_line { ...@@ -478,7 +476,7 @@ struct git_diff_line {
size_t content_len; /**< Number of bytes of data */ size_t content_len; /**< Number of bytes of data */
git_off_t content_offset; /**< Offset in the original file to the content */ git_off_t content_offset; /**< Offset in the original file to the content */
const char *content; /**< Pointer to diff text, not NUL-byte terminated */ const char *content; /**< Pointer to diff text, not NUL-byte terminated */
}; } git_diff_line;
/** /**
* When iterating over a diff, callback that will be made per text diff * When iterating over a diff, callback that will be made per text diff
......
...@@ -14,12 +14,11 @@ ...@@ -14,12 +14,11 @@
#include "fileops.h" #include "fileops.h"
/* cached information about a hunk in a diff */ /* cached information about a hunk in a diff */
typedef struct diff_patch_hunk diff_patch_hunk; typedef struct diff_patch_hunk {
struct diff_patch_hunk {
git_diff_hunk hunk; git_diff_hunk hunk;
size_t line_start; size_t line_start;
size_t line_count; size_t line_count;
}; } diff_patch_hunk;
struct git_patch { struct git_patch {
git_refcount rc; git_refcount rc;
......
...@@ -9,14 +9,12 @@ ...@@ -9,14 +9,12 @@
#include "vector.h" #include "vector.h"
struct git_fetchhead_ref { typedef struct git_fetchhead_ref {
git_oid oid; git_oid oid;
unsigned int is_merge; unsigned int is_merge;
char *ref_name; char *ref_name;
char *remote_url; char *remote_url;
}; } git_fetchhead_ref;
typedef struct git_fetchhead_ref git_fetchhead_ref;
int git_fetchhead_ref_create( int git_fetchhead_ref_create(
git_fetchhead_ref **fetchhead_ref_out, git_fetchhead_ref **fetchhead_ref_out,
......
...@@ -25,11 +25,12 @@ ...@@ -25,11 +25,12 @@
#define GIT_FILELOCK_EXTENSION ".lock\0" #define GIT_FILELOCK_EXTENSION ".lock\0"
#define GIT_FILELOCK_EXTLENGTH 6 #define GIT_FILELOCK_EXTLENGTH 6
typedef struct git_filebuf git_filebuf;
struct git_filebuf { struct git_filebuf {
char *path_original; char *path_original;
char *path_lock; char *path_lock;
int (*write)(struct git_filebuf *file, void *source, size_t len); int (*write)(git_filebuf *file, void *source, size_t len);
bool compute_digest; bool compute_digest;
git_hash_ctx digest; git_hash_ctx digest;
...@@ -47,8 +48,6 @@ struct git_filebuf { ...@@ -47,8 +48,6 @@ struct git_filebuf {
int last_error; int last_error;
}; };
typedef struct git_filebuf git_filebuf;
#define GIT_FILEBUF_INIT {0} #define GIT_FILEBUF_INIT {0}
/* /*
......
...@@ -14,34 +14,28 @@ ...@@ -14,34 +14,28 @@
# include <openssl/ssl.h> # include <openssl/ssl.h>
#endif #endif
struct gitno_ssl { typedef struct gitno_ssl {
#ifdef GIT_SSL #ifdef GIT_SSL
SSL *ssl; SSL *ssl;
#else #else
size_t dummy; size_t dummy;
#endif #endif
}; } gitno_ssl;
typedef struct gitno_ssl gitno_ssl;
/* Represents a socket that may or may not be using SSL */ /* Represents a socket that may or may not be using SSL */
struct gitno_socket { typedef struct gitno_socket {
GIT_SOCKET socket; GIT_SOCKET socket;
gitno_ssl ssl; gitno_ssl ssl;
}; } gitno_socket;
typedef struct gitno_socket gitno_socket; typedef struct gitno_buffer {
struct gitno_buffer {
char *data; char *data;
size_t len; size_t len;
size_t offset; size_t offset;
gitno_socket *socket; gitno_socket *socket;
int (*recv)(struct gitno_buffer *buffer); int (*recv)(struct gitno_buffer *buffer);
void *cb_data; void *cb_data;
}; } gitno_buffer;
typedef struct gitno_buffer gitno_buffer;
/* Flags to gitno_connect */ /* Flags to gitno_connect */
enum { enum {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include "common.h" #include "common.h"
#include "git2/oid.h" #include "git2/oid.h"
struct git_tree_cache { typedef struct {
struct git_tree_cache *parent; struct git_tree_cache *parent;
struct git_tree_cache **children; struct git_tree_cache **children;
size_t children_count; size_t children_count;
...@@ -20,9 +20,7 @@ struct git_tree_cache { ...@@ -20,9 +20,7 @@ struct git_tree_cache {
git_oid oid; git_oid oid;
size_t namelen; size_t namelen;
char name[GIT_FLEX_ARRAY]; char name[GIT_FLEX_ARRAY];
}; } git_tree_cache;
typedef struct git_tree_cache git_tree_cache;
int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size); int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size);
void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path); void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path);
......
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