Mercurial > pidgin.yaz
changeset 13212:64bae3cbec8d
[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 <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 10 Feb 2006 06:07:19 +0000 |
parents | ca559e2b1d0a |
children | 371f353f7d99 |
files | src/gaim_buffer.c src/gaim_buffer.h |
diffstat | 2 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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