diff libpurple/circbuffer.c @ 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 6bf32c9e15a7
children 70df8067d41e 584063555949
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;
 	}