pidgin: 34498a55: Clean up some unnecessary and unused cod...

datallah at pidgin.im datallah at pidgin.im
Tue Oct 21 23:50:39 EDT 2008


-----------------------------------------------------------------
Revision: 34498a55a9da4fdac121ada82469350d2d67984a
Ancestor: dd60852f53280649ffc76f6aca014bfb76e10426
Author: datallah at pidgin.im
Date: 2008-10-22T03:49:14
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/34498a55a9da4fdac121ada82469350d2d67984a

Modified files:
        libpurple/circbuffer.c

ChangeLog: 

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

-------------- next part --------------
============================================================
--- libpurple/circbuffer.c	8209e1034930cd720e5b7b80cdc3288920343000
+++ libpurple/circbuffer.c	314ec304e2d7408dd5633044098f87925819d044
@@ -109,13 +109,12 @@ void purple_circ_buffer_append(PurpleCir
 	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;
 	}


More information about the Commits mailing list