Greetings. In afgets() the size variable is never updated, which usually means it is always zero, in which case it has no purpose at all. I believe it is supposed to be updated on realloc? This way, calling afgets multiple times with the same arguments will reuse the space if possible.
Also, the return value is just a dereference of the pointer argument, which is not very useful. Why not return len instead, so the caller does not have to use strlen to get the length? All current uses of afgets() only check for a non-zero return value, which would work equally well if length is returned. Proposed change attached. -Truls
afgets.patch
Description: Binary data