I was working on some "programming reference" documents for the
buffer routines, and realized that many of them are close to the
standard 'stdio' routines.  Since they're so close, it makes 
sense to investigate whether a simple renaming would clarify the
interface.

The following patches make the following changes

1)
  struct buffer -> BUFFER  (analogous to FILE)

2)
  buf_output0() -> bputs()
  buf_append_char() -> bputc()

3)
  buf_free() -> bclose()
  buf_output() -> bwrite()

This is enough to decide whether the improved readibility (IMO :-)
is worth the effort of renaming many of the buffer routines.  It
would also be straightforward to implement "bprintf()" using
either a library vsnprintf(), or a local version.

The input routines are a bit more complex.  However, in many places
it should be possible to replace buf_read_line() with bgets() and
bread() that use a reasonably sized auto or static variable, avoiding
the hassles involved with handling memory allocation failure, freeing
allocated buffers, etc.

Bear Giles
bgiles (at) coyotesong (dot) com

_______________________________________________
Bug-cvs mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-cvs

Reply via email to