summaryrefslogtreecommitdiff
path: root/vcs-svn
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-08-13 19:01:34 -0500
committerJunio C Hamano <gitster@pobox.com>2010-08-14 19:35:38 -0700
commit68b4cfbc91583b43e96d38b8d7efc8e6690589ad (patch)
treef97483dee6e25409d1d6f8f3bf667dc77987ac52 /vcs-svn
parent78457bc0ccc1af8b9eb776a0b17986ebd50442bc (diff)
downloadgit-68b4cfbc91583b43e96d38b8d7efc8e6690589ad.tar.gz
vcs-svn: Rename dirent pool to build on Windows
dirent is #defineā€™d to mingw_dirent in compat/mingw.h, with the result that obj_pool_gen(dirent, struct repo_dirent, 4096) creates functions with names like mingw_dirent_alloc and references to dirent_alloc go unresolved. Rename the functions to dent_* to avoid this problem. Reported-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'vcs-svn')
-rw-r--r--vcs-svn/repo_tree.c146
1 files changed, 73 insertions, 73 deletions
diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index c3d7ee7d24..e94d91d129 100644
--- a/vcs-svn/repo_tree.c
+++ b/vcs-svn/repo_tree.c
@@ -30,7 +30,7 @@ struct repo_commit {
/* Memory pools for commit, dir and dirent */
obj_pool_gen(commit, struct repo_commit, 4096)
obj_pool_gen(dir, struct repo_dir, 4096)
-obj_pool_gen(dirent, struct repo_dirent, 4096)
+obj_pool_gen(dent, struct repo_dirent, 4096)
static uint32_t active_commit;
static uint32_t mark;
@@ -38,7 +38,7 @@ static uint32_t mark;
static int repo_dirent_name_cmp(const void *a, const void *b);
/* Treap for directory entries */
-trp_gen(static, dirent_, struct repo_dirent, children, dirent, repo_dirent_name_cmp);
+trp_gen(static, dent_, struct repo_dirent, children, dent, repo_dirent_name_cmp);
uint32_t next_blob_mark(void)
{
@@ -52,27 +52,27 @@ static struct repo_dir *repo_commit_root_dir(struct repo_commit *commit)
static struct repo_dirent *repo_first_dirent(struct repo_dir *dir)
{
- return dirent_first(&dir->entries);
+ return dent_first(&dir->entries);
}
static int repo_dirent_name_cmp(const void *a, const void *b)
{
- const struct repo_dirent *dirent1 = a, *dirent2 = b;
- uint32_t a_offset = dirent1->name_offset;
- uint32_t b_offset = dirent2->name_offset;
+ const struct repo_dirent *dent1 = a, *dent2 = b;
+ uint32_t a_offset = dent1->name_offset;
+ uint32_t b_offset = dent2->name_offset;
return (a_offset > b_offset) - (a_offset < b_offset);
}
-static int repo_dirent_is_dir(struct repo_dirent *dirent)
+static int repo_dirent_is_dir(struct repo_dirent *dent)
{
- return dirent != NULL && dirent->mode == REPO_MODE_DIR;
+ return dent != NULL && dent->mode == REPO_MODE_DIR;
}
-static struct repo_dir *repo_dir_from_dirent(struct repo_dirent *dirent)
+static struct repo_dir *repo_dir_from_dirent(struct repo_dirent *dent)
{
- if (!repo_dirent_is_dir(dirent))
+ if (!repo_dirent_is_dir(dent))
return NULL;
- return dir_pointer(dirent->content_offset);
+ return dir_pointer(dent->content_offset);
}
static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
@@ -90,19 +90,19 @@ static struct repo_dir *repo_clone_dir(struct repo_dir *orig_dir)
static struct repo_dirent *repo_read_dirent(uint32_t revision, uint32_t *path)
{
uint32_t name = 0;
- struct repo_dirent *key = dirent_pointer(dirent_alloc(1));
+ struct repo_dirent *key = dent_pointer(dent_alloc(1));
struct repo_dir *dir = NULL;
- struct repo_dirent *dirent = NULL;
+ struct repo_dirent *dent = NULL;
dir = repo_commit_root_dir(commit_pointer(revision));
while (~(name = *path++)) {
key->name_offset = name;
- dirent = dirent_search(&dir->entries, key);
- if (dirent == NULL || !repo_dirent_is_dir(dirent))
+ dent = dent_search(&dir->entries, key);
+ if (dent == NULL || !repo_dirent_is_dir(dent))
break;
- dir = repo_dir_from_dirent(dirent);
+ dir = repo_dir_from_dirent(dent);
}
- dirent_free(1);
- return dirent;
+ dent_free(1);
+ return dent;
}
static void repo_write_dirent(uint32_t *path, uint32_t mode,
@@ -111,7 +111,7 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
uint32_t name, revision, dir_o = ~0, parent_dir_o = ~0;
struct repo_dir *dir;
struct repo_dirent *key;
- struct repo_dirent *dirent = NULL;
+ struct repo_dirent *dent = NULL;
revision = active_commit;
dir = repo_commit_root_dir(commit_pointer(revision));
dir = repo_clone_dir(dir);
@@ -119,52 +119,52 @@ static void repo_write_dirent(uint32_t *path, uint32_t mode,
while (~(name = *path++)) {
parent_dir_o = dir_offset(dir);
- key = dirent_pointer(dirent_alloc(1));
+ key = dent_pointer(dent_alloc(1));
key->name_offset = name;
- dirent = dirent_search(&dir->entries, key);
- if (dirent == NULL)
- dirent = key;
+ dent = dent_search(&dir->entries, key);
+ if (dent == NULL)
+ dent = key;
else
- dirent_free(1);
+ dent_free(1);
- if (dirent == key) {
- dirent->mode = REPO_MODE_DIR;
- dirent->content_offset = 0;
- dirent_insert(&dir->entries, dirent);
+ if (dent == key) {
+ dent->mode = REPO_MODE_DIR;
+ dent->content_offset = 0;
+ dent_insert(&dir->entries, dent);
}
- if (dirent_offset(dirent) < dirent_pool.committed) {
- dir_o = repo_dirent_is_dir(dirent) ?
- dirent->content_offset : ~0;
- dirent_remove(&dir->entries, dirent);
- dirent = dirent_pointer(dirent_alloc(1));
- dirent->name_offset = name;
- dirent->mode = REPO_MODE_DIR;
- dirent->content_offset = dir_o;
- dirent_insert(&dir->entries, dirent);
+ if (dent_offset(dent) < dent_pool.committed) {
+ dir_o = repo_dirent_is_dir(dent) ?
+ dent->content_offset : ~0;
+ dent_remove(&dir->entries, dent);
+ dent = dent_pointer(dent_alloc(1));
+ dent->name_offset = name;
+ dent->mode = REPO_MODE_DIR;
+ dent->content_offset = dir_o;
+ dent_insert(&dir->entries, dent);
}
- dir = repo_dir_from_dirent(dirent);
+ dir = repo_dir_from_dirent(dent);
dir = repo_clone_dir(dir);
- dirent->content_offset = dir_offset(dir);
+ dent->content_offset = dir_offset(dir);
}
- if (dirent == NULL)
+ if (dent == NULL)
return;
- dirent->mode = mode;
- dirent->content_offset = content_offset;
+ dent->mode = mode;
+ dent->content_offset = content_offset;
if (del && ~parent_dir_o)
- dirent_remove(&dir_pointer(parent_dir_o)->entries, dirent);
+ dent_remove(&dir_pointer(parent_dir_o)->entries, dent);
}
uint32_t repo_copy(uint32_t revision, uint32_t *src, uint32_t *dst)
{
uint32_t mode = 0, content_offset = 0;
- struct repo_dirent *src_dirent;
- src_dirent = repo_read_dirent(revision, src);
- if (src_dirent != NULL) {
- mode = src_dirent->mode;
- content_offset = src_dirent->content_offset;
+ struct repo_dirent *src_dent;
+ src_dent = repo_read_dirent(revision, src);
+ if (src_dent != NULL) {
+ mode = src_dent->mode;
+ content_offset = src_dent->content_offset;
repo_write_dirent(dst, mode, content_offset, 0);
}
return mode;
@@ -178,10 +178,10 @@ void repo_add(uint32_t *path, uint32_t mode, uint32_t blob_mark)
uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
{
uint32_t mode = 0;
- struct repo_dirent *src_dirent;
- src_dirent = repo_read_dirent(active_commit, path);
- if (src_dirent != NULL) {
- mode = src_dirent->mode;
+ struct repo_dirent *src_dent;
+ src_dent = repo_read_dirent(active_commit, path);
+ if (src_dent != NULL) {
+ mode = src_dent->mode;
repo_write_dirent(path, mode, blob_mark, 0);
}
return mode;
@@ -189,10 +189,10 @@ uint32_t repo_replace(uint32_t *path, uint32_t blob_mark)
void repo_modify(uint32_t *path, uint32_t mode, uint32_t blob_mark)
{
- struct repo_dirent *src_dirent;
- src_dirent = repo_read_dirent(active_commit, path);
- if (src_dirent != NULL && blob_mark == 0)
- blob_mark = src_dirent->content_offset;
+ struct repo_dirent *src_dent;
+ src_dent = repo_read_dirent(active_commit, path);
+ if (src_dent != NULL && blob_mark == 0)
+ blob_mark = src_dent->content_offset;
repo_write_dirent(path, mode, blob_mark, 0);
}
@@ -203,13 +203,13 @@ void repo_delete(uint32_t *path)
static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir);
-static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dirent *dirent)
+static void repo_git_add(uint32_t depth, uint32_t *path, struct repo_dirent *dent)
{
- if (repo_dirent_is_dir(dirent))
- repo_git_add_r(depth, path, repo_dir_from_dirent(dirent));
+ if (repo_dirent_is_dir(dent))
+ repo_git_add_r(depth, path, repo_dir_from_dirent(dent));
else
fast_export_modify(depth, path,
- dirent->mode, dirent->content_offset);
+ dent->mode, dent->content_offset);
}
static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir)
@@ -218,7 +218,7 @@ static void repo_git_add_r(uint32_t depth, uint32_t *path, struct repo_dir *dir)
while (de) {
path[depth] = de->name_offset;
repo_git_add(depth + 1, path, de);
- de = dirent_next(&dir->entries, de);
+ de = dent_next(&dir->entries, de);
}
}
@@ -233,13 +233,13 @@ static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
if (de1->name_offset < de2->name_offset) {
path[depth] = de1->name_offset;
fast_export_delete(depth + 1, path);
- de1 = dirent_next(&dir1->entries, de1);
+ de1 = dent_next(&dir1->entries, de1);
continue;
}
if (de1->name_offset > de2->name_offset) {
path[depth] = de2->name_offset;
repo_git_add(depth + 1, path, de2);
- de2 = dirent_next(&dir2->entries, de2);
+ de2 = dent_next(&dir2->entries, de2);
continue;
}
path[depth] = de1->name_offset;
@@ -257,18 +257,18 @@ static void repo_diff_r(uint32_t depth, uint32_t *path, struct repo_dir *dir1,
fast_export_delete(depth + 1, path);
repo_git_add(depth + 1, path, de2);
}
- de1 = dirent_next(&dir1->entries, de1);
- de2 = dirent_next(&dir2->entries, de2);
+ de1 = dent_next(&dir1->entries, de1);
+ de2 = dent_next(&dir2->entries, de2);
}
while (de1) {
path[depth] = de1->name_offset;
fast_export_delete(depth + 1, path);
- de1 = dirent_next(&dir1->entries, de1);
+ de1 = dent_next(&dir1->entries, de1);
}
while (de2) {
path[depth] = de2->name_offset;
repo_git_add(depth + 1, path, de2);
- de2 = dirent_next(&dir2->entries, de2);
+ de2 = dent_next(&dir2->entries, de2);
}
}
@@ -286,7 +286,7 @@ void repo_commit(uint32_t revision, uint32_t author, char *log, uint32_t uuid,
uint32_t url, unsigned long timestamp)
{
fast_export_commit(revision, author, log, uuid, url, timestamp);
- dirent_commit();
+ dent_commit();
dir_commit();
active_commit = commit_alloc(1);
commit_pointer(active_commit)->root_dir_offset =
@@ -297,10 +297,10 @@ static void mark_init(void)
{
uint32_t i;
mark = 0;
- for (i = 0; i < dirent_pool.size; i++)
- if (!repo_dirent_is_dir(dirent_pointer(i)) &&
- dirent_pointer(i)->content_offset > mark)
- mark = dirent_pointer(i)->content_offset;
+ for (i = 0; i < dent_pool.size; i++)
+ if (!repo_dirent_is_dir(dent_pointer(i)) &&
+ dent_pointer(i)->content_offset > mark)
+ mark = dent_pointer(i)->content_offset;
mark++;
}
@@ -325,5 +325,5 @@ void repo_reset(void)
pool_reset();
commit_reset();
dir_reset();
- dirent_reset();
+ dent_reset();
}