> On Mar 5, 2015, at 12:36 PM, Yann Ylavic <[email protected]> wrote: > > On Thu, Mar 5, 2015 at 5:51 PM, <[email protected]> wrote: >> Author: jim >> Date: Thu Mar 5 16:51:39 2015 >> New Revision: 1664406 >> >> URL: http://svn.apache.org/r1664406 >> Log: >> FIX: Skiplists should allow for dups by default. Also, when added, dups >> are added *after* each other, not before >> >> Modified: >> apr/apr/trunk/include/apr_skiplist.h >> apr/apr/trunk/tables/apr_skiplist.c >> apr/apr/trunk/test/testskiplist.c >> > [..] >> Modified: apr/apr/trunk/tables/apr_skiplist.c >> URL: >> http://svn.apache.org/viewvc/apr/apr/trunk/tables/apr_skiplist.c?rev=1664406&r1=1664405&r2=1664406&view=diff >> ============================================================================== >> --- apr/apr/trunk/tables/apr_skiplist.c (original) >> +++ apr/apr/trunk/tables/apr_skiplist.c Thu Mar 5 16:51:39 2015 >> @@ -427,7 +427,7 @@ static apr_skiplistnode *insert_compare( >> skiplist_stack_clear(sl); >> return NULL; >> } >> - if (compared < 0) { >> + if (compared < 0 || ((compared <= 0) && add)) { > > This could be (compare <= 0) alone here, since (compare == 0 && !add) > is caught above. > > Otherwise, ++1 to this!
Nice optimization. +1
