summaryrefslogtreecommitdiff
path: root/vcs-svn
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2010-11-19 18:46:54 -0600
committerJunio C Hamano <gitster@pobox.com>2010-11-24 14:51:42 -0800
commitda3e217447390d52363989474a5e33bd298ff3ad (patch)
treee0dd4b8ac125557ed727f4232b8c3f1235725724 /vcs-svn
parent1d13e9f600986b7ced8db37a9a9c4967ee7ff9d5 (diff)
downloadgit-da3e217447390d52363989474a5e33bd298ff3ad.tar.gz
vcs-svn: Eliminate node_ctx.mark global
The mark variable is only used in handle_node(). Its life is very short and simple: first, a new mark number is allocated if this node has text attached, then that mark is recorded in the in-core tree being built up, and lastly the mark is communicated to fast-import in the stream along with the associated text. A new reader may worry about interaction with other code, especially since mark is not initialized to zero in handle_node() itself. Disperse such worries by making it local. No functional change intended. 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/svndump.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/vcs-svn/svndump.c b/vcs-svn/svndump.c
index 65bd335aa2..1fb7f82bba 100644
--- a/vcs-svn/svndump.c
+++ b/vcs-svn/svndump.c
@@ -40,7 +40,7 @@ static char* log_copy(uint32_t length, char *log)
}
static struct {
- uint32_t action, propLength, textLength, srcRev, mark, type;
+ uint32_t action, propLength, textLength, srcRev, type;
uint32_t src[REPO_MAX_PATH_DEPTH], dst[REPO_MAX_PATH_DEPTH];
uint32_t text_delta, prop_delta;
} node_ctx;
@@ -73,7 +73,6 @@ static void reset_node_ctx(char *fname)
node_ctx.src[0] = ~0;
node_ctx.srcRev = 0;
pool_tok_seq(REPO_MAX_PATH_DEPTH, node_ctx.dst, "/", fname);
- node_ctx.mark = 0;
node_ctx.text_delta = 0;
node_ctx.prop_delta = 0;
}
@@ -151,7 +150,7 @@ static void read_props(void)
static void handle_node(void)
{
- uint32_t old_mode = 0;
+ uint32_t old_mode = 0, mark = 0;
if (node_ctx.text_delta || node_ctx.prop_delta)
die("text and property deltas not supported");
@@ -164,7 +163,7 @@ static void handle_node(void)
if (node_ctx.textLength != LENGTH_UNKNOWN &&
node_ctx.type != REPO_MODE_DIR)
- node_ctx.mark = next_blob_mark();
+ mark = next_blob_mark();
if (node_ctx.action == NODEACT_DELETE) {
repo_delete(node_ctx.dst);
@@ -172,26 +171,26 @@ static void handle_node(void)
node_ctx.action == NODEACT_REPLACE) {
if (node_ctx.action == NODEACT_REPLACE &&
node_ctx.type == REPO_MODE_DIR)
- repo_replace(node_ctx.dst, node_ctx.mark);
+ repo_replace(node_ctx.dst, mark);
else if (node_ctx.propLength != LENGTH_UNKNOWN)
- repo_modify(node_ctx.dst, node_ctx.type, node_ctx.mark);
+ repo_modify(node_ctx.dst, node_ctx.type, mark);
else if (node_ctx.textLength != LENGTH_UNKNOWN)
- old_mode = repo_replace(node_ctx.dst, node_ctx.mark);
+ old_mode = repo_replace(node_ctx.dst, mark);
} else if (node_ctx.action == NODEACT_ADD) {
if (node_ctx.srcRev && node_ctx.propLength != LENGTH_UNKNOWN)
- repo_modify(node_ctx.dst, node_ctx.type, node_ctx.mark);
+ repo_modify(node_ctx.dst, node_ctx.type, mark);
else if (node_ctx.srcRev && node_ctx.textLength != LENGTH_UNKNOWN)
- old_mode = repo_replace(node_ctx.dst, node_ctx.mark);
+ old_mode = repo_replace(node_ctx.dst, mark);
else if ((node_ctx.type == REPO_MODE_DIR && !node_ctx.srcRev) ||
node_ctx.textLength != LENGTH_UNKNOWN)
- repo_add(node_ctx.dst, node_ctx.type, node_ctx.mark);
+ repo_add(node_ctx.dst, node_ctx.type, mark);
}
if (node_ctx.propLength == LENGTH_UNKNOWN && old_mode)
node_ctx.type = old_mode;
- if (node_ctx.mark)
- fast_export_blob(node_ctx.type, node_ctx.mark, node_ctx.textLength);
+ if (mark)
+ fast_export_blob(node_ctx.type, mark, node_ctx.textLength);
else if (node_ctx.textLength != LENGTH_UNKNOWN)
buffer_skip_bytes(node_ctx.textLength);
}