On 16/12/2014 9:32 PM, John McKown wrote:
On Tue, Dec 16, 2014 at 7:25 AM, David Crayford <dcrayf...@gmail.com> wrote:
Sorry to be critical but you really do need to check the return value from
malloc() and realloc(). I would also replace the ascending goto with a
while loop. Other than that it looks good.
Not critical, helpful! I put in a check on the malloc(). It never occurred
to me that the realloc() could fail because it is only used to shrink the
existing allocation. I guess that I thought that shrinking was always an
"in place" operation.
I'll fix that too.
I would have the client pass in a buffer and length and not do any heap
allocation. There should be a max length that can be specified in a
#define MAX_LRECL constant.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN