[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/1] buffer: add and use ssh_buffer_ensure_allocated

On Friday, 22 June 2018 09:40:16 CEST Pino Toscano wrote:
> Add a small helper for ssh_buffer to ensure that the buffer has a
> certain amount of space already preallocated. This can be useful in case
> it is known how much data is going to be added to a buffer, to avoid
> multiple reallocations.

Hi Pino,

thank you very much for your patch. Does this already solve your issue or is 
it just one step to make it faster?

Could you please rename ssh_buffer_ensure_allocated() to 
ssh_buffer_allocate_guaranteed() or ssh_buffer_allocate_fixed().

For the new function in buffer.c please use 4 spaces indentation. Yes, we are 
not consistent and are slow fixing it.

Instead of:

if (ssh_buffer_ensure_allocated(..) < 0)

please use

rc = ssh_buffer_ensure_allocated(..);
if (rc < 0)

for easier debugging.



Andreas Schneider                 asn@xxxxxxxxxxxxxx
GPG-ID:     8DFF53E18F2ABC8D8F3C92237EE0FC4DCC014E3D

[PATCH 0/1] RFC: add ssh_buffer_ensure_allocatedPino Toscano <ptoscano@xxxxxxxxxx>
[PATCH 1/1] buffer: add and use ssh_buffer_ensure_allocatedPino Toscano <ptoscano@xxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org