Re: [PATCH 36/67] remote-ext: simplify git pkt-line generation

2015-09-16 Thread Jeff King
On Wed, Sep 16, 2015 at 01:18:03PM -0700, Junio C Hamano wrote: > > + /* Now go back and fill in the size */ > > + if (buffer.len > 0x) > > die("Request too large to send"); > > + xsnprintf(buffer.buf, buffer.alloc, "%04x", (unsigned)buffer.len); > > So we now write "som

Re: [PATCH 36/67] remote-ext: simplify git pkt-line generation

2015-09-16 Thread Junio C Hamano
Jeff King writes: > static void send_git_request(int stdin_fd, const char *serv, const char > *repo, > const char *vhost) > { > - size_t bufferspace; > - size_t wpos = 0; > - char *buffer; > + struct strbuf buffer = STRBUF_INIT; > > - /* > - * Request needs 12

[PATCH 36/67] remote-ext: simplify git pkt-line generation

2015-09-15 Thread Jeff King
We format a pkt-line into a heap buffer, which requires manual computation of the required size. We can just use a strbuf instead, which handles this for us, and lets us drop some bare sprintf calls. Note that we _could_ also use a fixed-size buffer here, as we are limited by 16-bit pkt-line limit