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
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
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
3 matches
Mail list logo