Linus Torvalds writes: (Summary)
And hide it not as a explicit "char buffer[80]]" allocation, but as a
"struct line_buffer" or similar, so that
"struct line_buffer" or similar, so that
(a) people don't get the line size wrong
(a) people don't get the line size wrong
(b) the buffering code can add a few fields for length etc in there too (b) the buffering code can add a few fields for length etc in there too Introduce a few helper functions for it:
Introduce a few helper functions for it:
init_line_buffer(&buf);
print_line(&buf, fmt, args);
vprint_line(&buf, fmt, vararg);
finish_line(&buf);
finish_line(&buf);
or whatever, and it sounds like it should be pretty easy to use.
"struct line_buffer" or similar, so that
(a) people don't get the line size wrong
(a) people don't get the line size wrong
(b) the buffering code can add a few fields for length etc in there too (b) the buffering code can add a few fields for length etc in there too Introduce a few helper functions for it:
Introduce a few helper functions for it:
init_line_buffer(&buf);
print_line(&buf, fmt, args);
vprint_line(&buf, fmt, vararg);
finish_line(&buf);
finish_line(&buf);
or whatever, and it sounds like it should be pretty easy to use.