summaryrefslogtreecommitdiff
path: root/tests/core/pqueue.c
Commit message (Collapse)AuthorAgeFilesLines
* pqueue: resolve possible NULL pointer dereferencePatrick Steinhardt2016-10-281-0/+22
| | | | | | | | | | | | | | | | | | | The `git_pqueue` struct allows being fixed in its total number of entries. In this case, we simply throw away items that are inserted into the priority queue by examining wether the new item to be inserted has a higher priority than the previous smallest one. This feature somewhat contradicts our pqueue implementation in that it is allowed to not have a comparison function. In fact, we also fail to check if the comparison function is actually set in the case where we add a new item into a fully filled fixed-size pqueue. As we cannot determine which item is the smallest item in absence of a comparison function, we fix the `NULL` pointer dereference by simply dropping all new items which are about to be inserted into a full fixed-size pqueue.
* Fix pqueue sort boundary condition bugRussell Belfer2014-03-121-0/+31
| | | | | | If the pqueue comparison fn returned just 0 or 1 (think "a<b") then the sort order of returned items could be wrong because there was a "< 0" that really needed to be "<= 0". Yikes!!!
* Add some priority queue testsRussell Belfer2014-02-031-0/+97
I forgot that I wrote some tests for the new priority queue code.