changeset 24286:5f2496830fd4

Clean up some unnecessary and unused code in the purple_circ_buffer_append() function. Thanks to Ryan Fan for noticing. Also avoid calling memcpy for 0 bytes. Fixes #7282
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 22 Oct 2008 03:49:14 +0000
parents a4a7084ee09d
children 315a2a4f1f52
files libpurple/circbuffer.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/circbuffer.c	Tue Oct 21 16:26:31 2008 +0000
+++ b/libpurple/circbuffer.c	Wed Oct 22 03:49:14 2008 +0000
@@ -109,13 +109,12 @@
 	else
 		len_stored = len;
 
-	memcpy(buf->inptr, src, len_stored);
+	if (len_stored > 0)
+		memcpy(buf->inptr, src, len_stored);
 
 	if (len_stored < len) {
 		memcpy(buf->buffer, (char*)src + len_stored, len - len_stored);
 		buf->inptr = buf->buffer + (len - len_stored);
-	} else if ((buf->buffer - buf->inptr) == len_stored) {
-		buf->inptr = buf->buffer;
 	} else {
 		buf->inptr += len_stored;
 	}