diff options
-rw-r--r-- | git.c | 4 | ||||
-rw-r--r-- | index.c | 18 | ||||
-rw-r--r-- | index.h | 12 |
3 files changed, 17 insertions, 17 deletions
@@ -281,7 +281,7 @@ static int parse_info_file_path(pull_request *pr, const char *root) { return ret; } -pull_request *get_pull_request(index *idx, const char *root) { +pull_request *get_pull_request(index_t *idx, const char *root) { /* Do we have a valid index? */ if (is_valid_index(idx)) { char *pr_dir; @@ -519,7 +519,7 @@ file **get_branch_commits(git_branch *br) { return NULL; } -int create_pull_request_dir(pull_request *pr, index *idx, const char *root) { +int create_pull_request_dir(pull_request *pr, index_t *idx, const char *root) { int ret = 0; struct stat st; file **commits; @@ -5,10 +5,10 @@ #include "index.h" #include "macros.h" -static int index_strlen(index *idx) { +static int index_strlen(index_t *idx) { int len = 0; /* Get the length of the index. */ - for (index *i = idx; i != NULL; i = i->next) { + for (index_t *i = idx; i != NULL; i = i->next) { const int is_last = (i->next == NULL); const char *fmt = (i->type) "%llu" : "%s"; len += format_len(fmt, (i->type) ? i->num : i->name) + !is_last; @@ -16,7 +16,7 @@ static int index_strlen(index *idx) { return len; } -int is_valid_index(index *idx) { +int is_valid_index(index_t *idx) { int did_alloc = 0; char *err_str = NULL; @@ -50,7 +50,7 @@ int is_valid_index(index *idx) { return 1; } -char *make_index_path(const char *root, index *idx, int path_type) { +char *make_index_path(const char *root, index_t *idx, int path_type) { char *path; char *tmp; int path_len = strlen(root) + 1; @@ -60,7 +60,7 @@ char *make_index_path(const char *root, index *idx, int path_type) { } /* Get the length of the path. */ - for (index *i = idx; i != NULL; i = i->next) { + for (index_t *i = idx; i != NULL; i = i->next) { const int is_last = (i->next == NULL); const char *fmt = (i->type) "%llu" : "%s"; path_len += format_len(fmt, (i->type) ? i->num : i->name) + !is_last; @@ -71,7 +71,7 @@ char *make_index_path(const char *root, index *idx, int path_type) { /* Create the path. */ tmp += sprintf(tmp, "%s/", root); - for (index *i = idx; i != NULL; i = i->next) { + for (index_t *i = idx; i != NULL; i = i->next) { const int is_last = (i->next == NULL); const char *delm = (path_type) ? "-" : "/"; const char *fmt = (i->type) "%llu%s" : "%s%s"; @@ -81,12 +81,12 @@ char *make_index_path(const char *root, index *idx, int path_type) { return path; } -char *index_to_str(index *idx) { +char *index_to_str(index_t *idx) { if (is_valid_index(idx)) { char *idx_str = calloc(index_strlen(idx)+1, sizeof(char)); char *tmp = idx_str; /* Create the index. */ - for (index *i = idx; i != NULL; i = i->next) { + for (index_t *i = idx; i != NULL; i = i->next) { const int is_last = (i->next == NULL); const char *fmt = (i->type) "%llu%s" : "%s%s"; @@ -98,7 +98,7 @@ char *index_to_str(index *idx) { } } -int index_path_exists(index *idx, const char *root, char **path) { +int index_path_exists(index_t *idx, const char *root, char **path) { char *dummy; path = (path != NULL) ? path : &dummy; for (int i = 0; i < 2; ++i) { @@ -3,7 +3,7 @@ #include <stdint.h> -typedef struct index index; +typedef struct index index_t; struct index { uint8_t type; /* Index type. (0 = Named index, 1 = Numbered index) */ @@ -11,12 +11,12 @@ struct index { char *name; /* Named index. */ uint64_t num; /* Numbered index. */ }; - index *next; /* Next index. */ + index_t *next; /* Next index. */ }; -extern int is_valid_index(index *idx); -extern char *make_index_path(const char *root, index *idx, int path_type); -extern char *index_to_str(index *idx); -extern int index_path_exists(index *idx, const char *root, char **path); +extern int is_valid_index(index_t *idx); +extern char *make_index_path(const char *root, index_t *idx, int path_type); +extern char *index_to_str(index_t *idx); +extern int index_path_exists(index_t *idx, const char *root, char **path); #endif |