Small patch to physfs 1.1.1 to quiet Valgrind
JLM
jsado_sc3 at comcast.net
Thu Feb 26 19:32:07 EST 2009
I hope you will accept this small patch to physfs.c that prevents the
quick sort algorithm from performing a swap in the case that the two
elements to swap are in fact the same location in memory.
--- physfs.c.bak 2009-02-24 20:28:09.000000000 -0500
+++ physfs.c 2009-02-24 20:28:39.000000000 -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 */
I noticed this when testing out a program's memory leaks with Valgrind.
Thank you for your time.
More information about the physfs
mailing list