# HG changeset patch # User Mark Doliner # Date 1139551639 0 # Node ID 64bae3cbec8dac3612ee92e13e200a92410a1b08 # Parent ca559e2b1d0a3fce91a864ad9566525229c289d5 [gaim-migrate @ 15576] Mostly documentation. Is there any reason the if statement was written the way it was? This seems more clear to me. Also, gaim_buffer.c doesn't seem like the best name for this. I mean, it's a part of Gaim, does it really need "gaim" in the filename? circbuffer.c seems better to me. Anyone else have an opinion? Because you're wrong. No, just kidding. committer: Tailor Script diff -r ca559e2b1d0a -r 64bae3cbec8d src/gaim_buffer.c --- a/src/gaim_buffer.c Fri Feb 10 05:14:46 2006 +0000 +++ b/src/gaim_buffer.c Fri Feb 10 06:07:19 2006 +0000 @@ -90,8 +90,11 @@ if ((buf->buflen - buf->bufused) < len) grow_circ_buffer(buf, len); - /* If we may need to wrap */ - if ((buf->inptr - buf->outptr) >= 0) + /* If there is not enough room to copy all of src before hitting + * the end of the buffer then we will need to do two copies. + * One copy from inptr to the end of the buffer, and the + * second copy from the start of the buffer to the end of src. */ + if (buf->inptr >= buf->outptr) len_stored = MIN(len, buf->buflen - (buf->inptr - buf->buffer)); else diff -r ca559e2b1d0a -r 64bae3cbec8d src/gaim_buffer.h --- a/src/gaim_buffer.h Fri Feb 10 05:14:46 2006 +0000 +++ b/src/gaim_buffer.h Fri Feb 10 06:07:19 2006 +0000 @@ -40,8 +40,9 @@ * Creates a new circular buffer. This will not allocate any memory for the * actual buffer until data is appended to it. * - * @param growsize The size that the buffer should grow by the first time data - * is appended and every time more space is needed. + * @param growsize The amount that the buffer should grow the first time data + * is appended and every time more space is needed. Pass in + * "0" to use the default of 256 bytes. * * @return The new GaimCircBuffer. This should be freed with * gaim_circ_buffer_destroy when you are done with it @@ -57,8 +58,8 @@ void gaim_circ_buffer_destroy(GaimCircBuffer *buf); /** - * Append data to the GaimCircBuffer. This will automatically grow the internal - * buffer to fit the added data. + * Append data to the GaimCircBuffer. This will grow the internal + * buffer to fit the added data, if needed. * * @param buf The GaimCircBuffer to which to append the data * @param src pointer to the data to copy into the buffer