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

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



I am looking for least expensive options. No buffer copying, etc.

Peek or search API will take us to the spot, but, any buffer iovec writes will result in undefined behavior, as per documentation.


On Nov 15, 2016 2:34 PM, "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.

  Azat.
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.