All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: Peter Baumann <waste.manager@gmx.de>,
	Jonathan Nieder <jrnieder@gmail.com>,
	David Barr <david.barr@cordelta.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Erik Faye-Lund <kusmabite@gmail.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH 3/5] strbuf: Introduce strbuf_fwrite corresponding to strbuf_fread
Date: Tue, 29 Mar 2011 23:43:10 +0530	[thread overview]
Message-ID: <1301422392-21177-4-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1301422392-21177-1-git-send-email-artagnon@gmail.com>

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 strbuf.c |   11 +++++++++++
 strbuf.h |    1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/strbuf.c b/strbuf.c
index 77444a9..bdfd0d0 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -290,6 +290,17 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f)
 	return res;
 }
 
+size_t strbuf_fwrite(struct strbuf *sb, size_t size, FILE *f)
+{
+	size_t res;
+
+	if (size > sb->len)
+		res = fwrite(sb->buf, 1, sb->len, f);
+	else 
+		res = fwrite(sb->buf, 1, size, f);
+	return res;
+}
+
 ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint)
 {
 	size_t oldlen = sb->len;
diff --git a/strbuf.h b/strbuf.h
index f722331..c68361c 100644
--- a/strbuf.h
+++ b/strbuf.h
@@ -124,6 +124,7 @@ __attribute__((format (printf,2,0)))
 extern void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap);
 
 extern size_t strbuf_fread(struct strbuf *, size_t, FILE *);
+extern size_t strbuf_fwrite(struct strbuf *, size_t, FILE *);
 /* XXX: if read fails, any partial read is undone */
 extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint);
 extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint);
-- 
1.7.4.rc1.7.g2cf08.dirty

  parent reply	other threads:[~2011-03-29 18:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 18:13 [PATCH 0/5] Towards a Git to SVN bridge Ramkumar Ramachandra
2011-03-29 18:13 ` [PATCH 1/5] date: Expose the time_to_tm function Ramkumar Ramachandra
2011-03-29 18:13 ` [PATCH 2/5] fast-export: Introduce --inline-blobs Ramkumar Ramachandra
2011-03-29 20:44   ` Jonathan Nieder
2011-03-29 18:13 ` Ramkumar Ramachandra [this message]
2011-03-31  2:15   ` [PATCH 3/5] strbuf: Introduce strbuf_fwrite corresponding to strbuf_fread Jonathan Nieder
2011-03-29 18:13 ` [PATCH 4/5] vcs-svn: Introduce svnload, a dumpfile producer Ramkumar Ramachandra
2011-03-29 18:13 ` [PATCH 5/5] t9012-svn-fi: Add tests for svn-fi Ramkumar Ramachandra
2011-03-31 23:23   ` 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=1301422392-21177-4-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=david.barr@cordelta.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=kusmabite@gmail.com \
    --cc=srabbelier@gmail.com \
    --cc=waste.manager@gmx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.