summaryrefslogtreecommitdiff
path: root/transport-helper.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2009-09-12 08:54:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-09-13 08:32:04 (GMT)
commit3d913526b19545eb4e463f96d2f3b8db8daae6ef (patch)
tree461508cde44a83841394b2868e9d26bf02c61eb2 /transport-helper.c
parentcd03eebbfdae712bd4a10d6b393980a8137ce305 (diff)
downloadgit-3d913526b19545eb4e463f96d2f3b8db8daae6ef.zip
git-3d913526b19545eb4e463f96d2f3b8db8daae6ef.tar.gz
git-3d913526b19545eb4e463f96d2f3b8db8daae6ef.tar.bz2
use write_str_in_full helper to avoid literal string lengths
This is the same fix to use write_str_in_full() helper to write a constant string out without counting the length of it ourselves. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'transport-helper.c')
-rw-r--r--transport-helper.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/transport-helper.c b/transport-helper.c
index b1ea7e6..832d81f 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -37,9 +37,7 @@ static struct child_process *get_helper(struct transport *transport)
die("Unable to run helper: git %s", helper->argv[0]);
data->helper = helper;
- strbuf_addstr(&buf, "capabilities\n");
- write_in_full(helper->in, buf.buf, buf.len);
- strbuf_reset(&buf);
+ write_str_in_full(helper->in, "capabilities\n");
file = fdopen(helper->out, "r");
while (1) {
@@ -58,7 +56,7 @@ static int disconnect_helper(struct transport *transport)
{
struct helper_data *data = transport->data;
if (data->helper) {
- write_in_full(data->helper->in, "\n", 1);
+ write_str_in_full(data->helper->in, "\n");
close(data->helper->in);
finish_command(data->helper);
free((char *)data->helper->argv[0]);
@@ -124,9 +122,7 @@ static struct ref *get_refs_list(struct transport *transport, int for_push)
helper = get_helper(transport);
- strbuf_addstr(&buf, "list\n");
- write_in_full(helper->in, buf.buf, buf.len);
- strbuf_reset(&buf);
+ write_str_in_full(helper->in, "list\n");
file = fdopen(helper->out, "r");
while (1) {