[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] * src/tests/run_test.c: Corrected some memory leacs, changed int
[PATCH] * src/tests/run_test.c: Corrected some memory leacs, changed interface for send_data accondiinly and indented file
Wed, 17 Feb 2010 15:11:01 -0600
Rui Batista wrote:
> Changed all the code to allocate memory directly on the stack and reuse
> buffers so new ones don't need to be created for every reply.
> The interface to send_data is changed with a new parameter to pass the reply
> buffer. If wfr argument is 0 reply is not touched so it can be NULL.
Cool! Almost perfect. I hate to pick on you
with my (hopefully constructive) criticism.
You should give reply a size of REPLY_BUFFER_SIZE + 1.
As it is, reply[bytes] = '\0' will put a NUL byte at the first position
following the end of the buffer, whenever bytes == REPLY_BUFFER_SIZE.
Re-indenting source files in a patch makes your patches harder to review.
I realize that parts of the code need a re-indent.
Myself, I'd like to see some stylistic guidelines eventually, along with
a .indent.pro file, so that we can use the indent utility to enforce
those guidelines whilst we code. But that is a separate issue.