From: David Barr <david.barr@cordelta.com>
To: Git Mailing List <git@vger.kernel.org>
Cc: Jonathan Nieder <jrnieder@gmail.com>,
Ramkumar Ramachandra <artagnon@gmail.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
David Barr <david.barr@cordelta.com>
Subject: [PATCH 4/5] vcs-svn: Add outfile option to buffer_copy_bytes()
Date: Fri, 15 Oct 2010 23:54:15 +1100 [thread overview]
Message-ID: <1287147256-9457-5-git-send-email-david.barr@cordelta.com> (raw)
In-Reply-To: <1287147256-9457-1-git-send-email-david.barr@cordelta.com>
Explicitly declare that output is to stdout for existing use.
Allow users of buffer_copy_bytes() to specify the output file.
Signed-off-by: David Barr <david.barr@cordelta.com>
---
test-line-buffer.c | 2 +-
vcs-svn/fast_export.c | 2 +-
vcs-svn/line_buffer.c | 6 +++---
vcs-svn/line_buffer.h | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/test-line-buffer.c b/test-line-buffer.c
index f9af892..adc23e8 100644
--- a/test-line-buffer.c
+++ b/test-line-buffer.c
@@ -36,7 +36,7 @@ int main(int argc, char *argv[])
buffer_skip_bytes(&buf, 1);
if (!(s = buffer_read_line(&buf)))
break;
- buffer_copy_bytes(&buf, strtouint32(s) + 1);
+ buffer_copy_bytes(&buf, stdout, strtouint32(s) + 1);
}
if (buffer_deinit(&buf))
die("input error");
diff --git a/vcs-svn/fast_export.c b/vcs-svn/fast_export.c
index d984aaa..b017dfb 100644
--- a/vcs-svn/fast_export.c
+++ b/vcs-svn/fast_export.c
@@ -73,6 +73,6 @@ void fast_export_blob(uint32_t mode, uint32_t mark, uint32_t len,
len -= 5;
}
printf("blob\nmark :%"PRIu32"\ndata %"PRIu32"\n", mark, len);
- buffer_copy_bytes(input, len);
+ buffer_copy_bytes(input, stdout, len);
fputc('\n', stdout);
}
diff --git a/vcs-svn/line_buffer.c b/vcs-svn/line_buffer.c
index c54031b..676cb62 100644
--- a/vcs-svn/line_buffer.c
+++ b/vcs-svn/line_buffer.c
@@ -82,7 +82,7 @@ void buffer_read_binary(struct strbuf *sb, uint32_t size,
strbuf_fread(sb, size, buf->infile);
}
-void buffer_copy_bytes(struct line_buffer *buf, off_t len)
+void buffer_copy_bytes(struct line_buffer *buf, FILE *outfile, off_t len)
{
char byte_buffer[COPY_BUFFER_LEN];
uint32_t in;
@@ -90,8 +90,8 @@ void buffer_copy_bytes(struct line_buffer *buf, off_t len)
in = len < COPY_BUFFER_LEN ? len : COPY_BUFFER_LEN;
in = fread(byte_buffer, 1, in, buf->infile);
len -= in;
- fwrite(byte_buffer, 1, in, stdout);
- if (ferror(stdout)) {
+ fwrite(byte_buffer, 1, in, outfile);
+ if (ferror(outfile)) {
buffer_skip_bytes(buf, len);
return;
}
diff --git a/vcs-svn/line_buffer.h b/vcs-svn/line_buffer.h
index 2375ee1..23f4931 100644
--- a/vcs-svn/line_buffer.h
+++ b/vcs-svn/line_buffer.h
@@ -20,7 +20,7 @@ char *buffer_read_line(struct line_buffer *buf);
char *buffer_read_string(struct line_buffer *buf, uint32_t len);
int buffer_read_char(struct line_buffer *buf);
void buffer_read_binary(struct strbuf *sb, uint32_t len, struct line_buffer *f);
-void buffer_copy_bytes(struct line_buffer *buf, off_t len);
+void buffer_copy_bytes(struct line_buffer *buf, FILE *outfile, off_t len);
off_t buffer_skip_bytes(struct line_buffer *buf, off_t len);
void buffer_reset(struct line_buffer *buf);
--
1.7.3.32.g634ef
next prev parent reply other threads:[~2010-10-15 12:55 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 12:54 [PATCHv2] Add support for subversion dump format v3 David Barr
2010-10-15 12:54 ` [PATCH 1/5] fast-import: Let importers retrieve blobs David Barr
2010-10-18 7:36 ` Ramkumar Ramachandra
2010-10-18 8:50 ` Jonathan Nieder
2010-10-18 8:26 ` Jonathan Nieder
[not found] ` <20101119093530.GA19061@burratino>
2010-11-19 9:47 ` [PATCH 3/4] fast-import: let " Jonathan Nieder
2010-11-19 9:51 ` [PATCH 4/4] fast-import: Allow cat-blob requests at arbitrary points in stream Jonathan Nieder
[not found] ` <20101119094045.GC19061@burratino>
2010-11-19 11:58 ` [PATCH 2/4] fast-import: clarify documentation of "feature" command Sverre Rabbelier
2010-11-28 19:41 ` [PATCH/RFC v3 resend 0/4] fast-import: Let importers retrieve blobs Jonathan Nieder
2010-11-28 19:42 ` [PATCH 1/4] fast-import: stricter parsing of integer options Jonathan Nieder
2010-11-30 1:01 ` Junio C Hamano
2010-11-28 19:43 ` [PATCH 2/4] fast-import: clarify documentation of "feature" command Jonathan Nieder
2010-11-28 19:45 ` [PATCH 3/4] fast-import: let importers retrieve blobs Jonathan Nieder
2010-11-29 23:48 ` [PATCH] fixup! " David Barr
2010-11-30 0:16 ` David Barr
2010-11-30 1:22 ` Jonathan Nieder
2010-12-03 10:30 ` [PATCH 3/4] " Thomas Rast
2010-12-03 19:06 ` Jonathan Nieder
2010-12-03 20:17 ` Junio C Hamano
2010-12-03 20:26 ` Jonathan Nieder
2010-12-04 13:24 ` Thomas Rast
2010-12-04 2:35 ` Jonathan Nieder
2011-01-16 2:16 ` [PATCH] Documentation/fast-import: capitalize beginning of sentence Jonathan Nieder
2010-11-28 19:45 ` [PATCH 4/4] fast-import: Allow cat-blob requests at arbitrary points in stream Jonathan Nieder
2010-10-15 12:54 ` [PATCH 2/5] vcs-svn: Extend svndump to parse version 3 format David Barr
2010-10-15 12:54 ` [PATCH 3/5] vcs-svn: Implement prop-delta handling David Barr
2010-10-18 15:10 ` Ramkumar Ramachandra
2010-10-15 12:54 ` David Barr [this message]
2010-10-18 8:59 ` [PATCH 4/5] vcs-svn: Add outfile option to buffer_copy_bytes() Jonathan Nieder
2010-10-15 12:54 ` [PATCH 5/5] svn-fe: Use the cat-blob command to apply deltas David Barr
2010-10-18 6:57 ` Ramkumar Ramachandra
2010-10-18 9:24 ` Jonathan Nieder
2010-10-18 12:18 ` Ramkumar Ramachandra
2010-10-18 9:54 ` [PATCHv2] Add support for subversion dump format v3 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287147256-9457-5-git-send-email-david.barr@cordelta.com \
--to=david.barr@cordelta.com \
--cc=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=srabbelier@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).