Valgrind fix: avoid overlapping memcpy() in sorting routines (thanks, JLM!).
authorRyan C. Gordon <icculus@icculus.org>
Sat, 28 Feb 2009 01:34:02 -0500
changeset 948 923323444178
parent 947 b0c91495af9b
child 950 7bb0b0d26479
Valgrind fix: avoid overlapping memcpy() in sorting routines (thanks, JLM!).
physfs.c
--- a/physfs.c	Wed Nov 05 14:42:48 2008 -0500
+++ b/physfs.c	Sat Feb 28 01:34:02 2009 -0500
@@ -245,7 +245,8 @@
                 break;
             swapfn(a, i, j);
         } /* while */
-        swapfn(a, i, hi-1);
+        if (i != (hi-1))
+            swapfn(a, i, hi-1);
         __PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn);
         __PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn);
     } /* else */