Logo Search packages:      
Sourcecode: transmission version File versions  Download package

int evbuffer_add ( struct evbuffer *  ,
const void *  ,
size_t   
)

Append data to the end of an evbuffer.

Parameters:
buf the event buffer to be appended to
data pointer to the beginning of the data buffer
datlen the number of bytes to be copied from the data buffer

Definition at line 301 of file buffer.c.

{
      size_t need = buf->misalign + buf->off + datlen;
      size_t oldoff = buf->off;

      if (buf->totallen < need) {
            if (evbuffer_expand(buf, datlen) == -1)
                  return (-1);
      }

      memcpy(buf->buffer + buf->off, data, datlen);
      buf->off += datlen;

      if (datlen && buf->cb != NULL)
            (*buf->cb)(buf, oldoff, buf->off, buf->cbarg);

      return (0);
}


Generated by  Doxygen 1.6.0   Back to index