git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Johannes Sixt <j6t@kdbg.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org, Ramkumar Ramachandra <artagnon@gmail.com>,
	David Barr <david.barr@cordelta.com>,
	Jakub Narebski <jnareb@gmail.com>
Subject: [PATCH 2/5] vcs-svn: Rename dirent pool to build on Windows
Date: Fri, 13 Aug 2010 19:01:34 -0500	[thread overview]
Message-ID: <20100814000133.GE2153@burratino> (raw)
In-Reply-To: <20100813234723.GC2153@burratino>

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>
---
 vcs-svn/repo_tree.c |  146 +++++++++++++++++++++++++-------------------------
 1 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/vcs-svn/repo_tree.c b/vcs-svn/repo_tree.c
index c3d7ee7..e94d91d 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();
 }
-- 
1.7.2.1.544.ga752d.dirty

  parent reply	other threads:[~2010-08-14  0:03 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11 23:35 What's cooking in git.git (Aug 2010, #02; Wed, 11) Junio C Hamano
2010-08-12  1:41 ` Jonathan Nieder
2010-08-12  2:33   ` Ævar Arnfjörð Bjarmason
2010-08-12  3:15     ` jn/commit-no-change-wo-status (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
2010-08-12  5:47 ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Elijah Newren
2010-08-12 15:49   ` Junio C Hamano
2010-08-12 21:12     ` Elijah Newren
2010-08-12  9:23 ` Johannes Sixt
2010-08-12  9:37   ` Greg Brockman
2010-08-12 10:11     ` Ævar Arnfjörð Bjarmason
2010-08-12 22:08     ` Junio C Hamano
2010-08-12 22:13       ` Greg Brockman
2010-08-12 22:19       ` Junio C Hamano
2010-08-12 10:20   ` Ævar Arnfjörð Bjarmason
2010-08-12 11:35     ` Erik Faye-Lund
2010-08-12 16:50       ` Ævar Arnfjörð Bjarmason
2010-08-12 17:34         ` Chris Packham
2010-08-12 18:35           ` Ævar Arnfjörð Bjarmason
2010-08-12 22:19             ` windows smoke tester (was Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Chris Packham
2010-08-12 22:29               ` Ævar Arnfjörð Bjarmason
2010-08-12 22:58                 ` Chris Packham
2010-08-13  1:01                   ` Ævar Arnfjörð Bjarmason
2010-08-14  0:42                     ` Chris Packham
2010-08-14  0:46                       ` Ævar Arnfjörð Bjarmason
2010-08-15  0:54                       ` Tay Ray Chuan
2010-08-15  1:08                         ` Ævar Arnfjörð Bjarmason
2010-08-15 17:39                           ` Tay Ray Chuan
2010-08-12 10:21   ` What's cooking in git.git (Aug 2010, #02; Wed, 11) Ilari Liusvaara
2010-08-12 10:31     ` Johannes Sixt
2010-08-12 15:25       ` Ilari Liusvaara
2010-08-12 12:43   ` Elijah Newren
2010-08-12 22:21     ` Junio C Hamano
2010-08-12 21:58   ` Junio C Hamano
2010-08-12 22:40   ` jn/apply-filename-with-sp (Re: What's cooking in git.git (Aug 2010, #02; Wed, 11)) Jonathan Nieder
2010-08-12 22:46     ` Ævar Arnfjörð Bjarmason
2010-08-12 23:17     ` Junio C Hamano
2010-08-13  0:59       ` Ævar Arnfjörð Bjarmason
2010-08-13 21:44     ` Johannes Sixt
2010-08-14  2:27       ` Jonathan Nieder
2010-08-14 18:37         ` Johannes Sixt
2010-08-15  0:05           ` Jonathan Nieder
2010-08-19  1:45           ` [PATCH v2 0/3] apply: handle traditional patches with space in filename Jonathan Nieder
2010-08-19  1:46             ` [PATCH 1/3] apply: split quoted filename handling into new function Jonathan Nieder
2010-08-19  1:48             ` [PATCH 2/3] tests: exercise "git apply" with weird filenames Jonathan Nieder
2010-08-19  1:50             ` [PATCH 3/3] apply: handle traditional patches with space in filename Jonathan Nieder
2010-08-19 19:56             ` [PATCH v2 0/3] " Johannes Sixt
2010-08-20  6:26               ` Jonathan Nieder
2010-08-13  0:08   ` jn/svn-fe Jonathan Nieder
2010-08-13 10:18     ` jn/svn-fe Jakub Narebski
2010-08-13 21:33     ` jn/svn-fe Johannes Sixt
2010-08-13 23:47       ` [PATCH v2 jn/svn-fe 0/5] vcs-svn: Port to Windows Jonathan Nieder
2010-08-13 23:59         ` [PATCH 1/5] compat: add strtok_r() Jonathan Nieder
2010-08-14  0:01         ` Jonathan Nieder [this message]
2010-08-14  0:03         ` [PATCH 3/5] vcs-svn: Avoid %z in format string Jonathan Nieder
2010-08-14  0:04         ` [PATCH 4/5] t9010 (svn-fe): use Unix-style path in URI Jonathan Nieder
2010-08-14  0:06         ` [PATCH 5/5] t9010 (svn-fe): avoid symlinks in test Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100814000133.GE2153@burratino \
    --to=jrnieder@gmail.com \
    --cc=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jnareb@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).