2012/1/24 Tanguy LE CARROUR <[email protected]>:
> 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?!

It does when tabs are displayed as 8 spaces, though it is inconsistent
wrt. some tabs being expanded as spaces.

>> - 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) {

You'll double the size each time, it's okay.

> 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?

1280 bytes, after 7 iterations.

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

Looks fine,
-- 
Jérémie Koenig <[email protected]>
http://jk.fr.eu.org/


--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: 
http://lists.debian.org/CA+kCSAZjt1Bfzyds6qr9UvZCK_kJoK=gn3-cr5zgfuzom7f...@mail.gmail.com

Reply via email to