summaryrefslogtreecommitdiff
path: root/index.c
diff options
context:
space:
mode:
Diffstat (limited to 'index.c')
-rw-r--r--index.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/index.c b/index.c
index af65925..2ea8971 100644
--- a/index.c
+++ b/index.c
@@ -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) {