summaryrefslogtreecommitdiff
path: root/pkt-line.c
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-10-16 17:55:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-10-17 01:51:29 (GMT)
commit5d2124b34a11967b56bfeb57556be5e4583172c8 (patch)
tree5f4a2c5923b639c8b499608ef93cc038c3889043 /pkt-line.c
parent0cd83283dfd2a22b3f95cbee6eaef196e6bde77d (diff)
downloadgit-5d2124b34a11967b56bfeb57556be5e4583172c8.zip
git-5d2124b34a11967b56bfeb57556be5e4583172c8.tar.gz
git-5d2124b34a11967b56bfeb57556be5e4583172c8.tar.bz2
pkt-line: add packet_write function
Add a function which can be used to write the contents of an arbitrary buffer. This makes it easy to build up data in a buffer before writing the packet instead of formatting the entire contents of the packet using 'packet_write_fmt()'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pkt-line.c')
-rw-r--r--pkt-line.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/pkt-line.c b/pkt-line.c
index 647bbd3..7006b35 100644
--- a/pkt-line.c
+++ b/pkt-line.c
@@ -188,6 +188,12 @@ static int packet_write_gently(const int fd_out, const char *buf, size_t size)
return 0;
}
+void packet_write(int fd_out, const char *buf, size_t size)
+{
+ if (packet_write_gently(fd_out, buf, size))
+ die_errno("packet write failed");
+}
+
void packet_buf_write(struct strbuf *buf, const char *fmt, ...)
{
va_list args;