[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patches following for 'buffer'

From: Bear Giles
Subject: patches following for 'buffer'
Date: Tue, 12 Jun 2001 21:38:38 -0600 (MDT)

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

The following patches make the following changes

  struct buffer -> BUFFER  (analogous to FILE)

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

  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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]