[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Inline modification of evbuffer data



On Wed, Nov 16, 2016 at 1:34 AM, Azat Khuzhin <a3at.mail@xxxxxxxxx> wrote:
> On Tue, Nov 15, 2016 at 9:12 PM, Devi Prasad Ivaturi <divaturi@xxxxxxxxx> wrote:
>> How can I modify a byte or two directly in evbuffer data?
>
> Hi,
>
> If you don't want to use pullup, you can use something like (but only
> if you data at the beginning of the buffer, otherwise it is like
> pullup):
>   evbuffer_remove(buf, data, bytes);
>   data[1] = 'x';
>   evbuffer_prepend(buf, data, bytes);
>
> Or
>   evbuffer_ptr_evbuffer_search() # but be aware of continuous
>
> But I'm not sure that this is optimal though.

That said that it depends from size of the part you need to drain,
overall evbuffer size and it's state (i.e. is it fragmented or not).
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.