Subject: [PATCH 05/10] vcs-svn: split off function to export result from delta application

From: Jonathan Nieder <[email-masked]>
Date: Fri, 10 Dec 2010 04:25:17 -0600

In this time of heavy experimentation, we will need multiple
fast_export_blob_delta variants.  Make this easier by factoring
out the common part.

Signed-off-by: Jonathan Nieder <[email-masked]>
---
Also not needed, except perhaps as code cleanup.

 vcs-svn/fast_export.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index 4168184..960b252 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -159,6 +159,18 @@ static long delta_apply(uint32_t mark, off_t len, struct line_buffer *input,
 	return ret;
 }
 
+static void record_postimage(uint32_t mark, uint32_t mode,
+				long postimage_len)
+{
+	if (mode == REPO_MODE_LNK) {
+		buffer_skip_bytes(&postimage, strlen("link "));
+		postimage_len -= strlen("link ");
+	}
+	printf("blob\nmark :%"PRIu32"\ndata %ld\n", mark, postimage_len);
+	buffer_copy_bytes(&postimage, postimage_len);
+	fputc('\n', stdout);
+}
+
 void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len, struct line_buffer *input)
 {
 	if (mode == REPO_MODE_LNK) {
@@ -181,11 +193,5 @@ void fast_export_blob_delta(uint32_t mode, uint32_t mark,
 	postimage_len = delta_apply(mark, (off_t) len, input,
 						old_mark ? cat_mark(old_mark) : -1,
 						old_mode);
-	if (mode == REPO_MODE_LNK) {
-		buffer_skip_bytes(&postimage, strlen("link "));
-		postimage_len -= strlen("link ");
-	}
-	printf("blob\nmark :%"PRIu32"\ndata %ld\n", mark, postimage_len);
-	buffer_copy_bytes(&postimage, postimage_len);
-	fputc('\n', stdout);
+	record_postimage(mark, mode, postimage_len);
 }
-- 
1.7.2.4