2012/1/24 Jérémie Koenig <j...@jk.fr.eu.org>

> get_line()

- The body of the while loop should probably be indented.
>
The indentation is really strange! For example, line 112 from the original
memstat.c: (tab '------>', space '.')

------->....if (errno != 0) {
------->------->perror("strtol");
................exit(1);
............}

Does it make any sense?! Anyway, I'll try be to as close as I can to the
source.

- fgets(buf + last, buf_size - last, f); then you can realloc
> unconditionally
>
I still need to check if the buffer size needs to be increased, or I'll
increase it each time I read a part of the line?!
if (buf_size < last + BUFSIZ + 1) {
This may not be a problem as line are "supposed" to be "short" and buffer
is "big", but if I had a 10 char. buffer on a 1000 char. line I would end
up with a BIG buffer, wouldn't I?

I used Richard's "#define FORMAT/BUFF_SIZE" fix in 2 places and left the
3rd one as dynamic allocation.
I also removed the useless "include <math.h>" and re-indented some lines.

I hope I've fixed everything, except for the "to increase or not to
increase the buffer" on each iteration in the get_line().

Cheers,
Tanguy

Attachment: memstat-0.9.hurd.patch
Description: Binary data

Reply via email to