You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2015/03/08 11:10:01 UTC
svn commit: r1664958 - in /apr/apr/trunk: tables/apr_skiplist.c
test/testskiplist.c
Author: ylavic
Date: Sun Mar 8 10:10:01 2015
New Revision: 1664958
URL: http://svn.apache.org/r1664958
Log:
skiplist:
When removing the last node, we have top = bottom = NULL,
and must set topend = bottomend = NULL too.
Also fix test from r1664471 according to r1664911.
Modified:
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=1664958&r1=1664957&r2=1664958&view=diff
==============================================================================
--- apr/apr/trunk/tables/apr_skiplist.c (original)
+++ apr/apr/trunk/tables/apr_skiplist.c Sun Mar 8 10:10:01 2015
@@ -606,7 +606,8 @@ static int skiplisti_remove(apr_skiplist
sl->height--;
}
if (!sl->top) {
- sl->bottom = NULL;
+ sl->bottom = sl->bottomend = NULL;
+ sl->topend = NULL;
}
return sl->height; /* return 1; ?? */
}
Modified: apr/apr/trunk/test/testskiplist.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/test/testskiplist.c?rev=1664958&r1=1664957&r2=1664958&view=diff
==============================================================================
--- apr/apr/trunk/test/testskiplist.c (original)
+++ apr/apr/trunk/test/testskiplist.c Sun Mar 8 10:10:01 2015
@@ -334,13 +334,13 @@ static void skiplist_test(abts_case *tc,
val = apr_skiplist_pop(list, NULL);
ABTS_INT_EQUAL(tc, *val, 1);
val = apr_skiplist_peek(list);
- ABTS_PTR_EQUAL(tc, val, &second_forty_two);
+ ABTS_PTR_EQUAL(tc, val, &first_forty_two);
ABTS_INT_EQUAL(tc, *val, 42);
val = apr_skiplist_pop(list, NULL);
- ABTS_PTR_EQUAL(tc, val, &second_forty_two);
+ ABTS_PTR_EQUAL(tc, val, &first_forty_two);
ABTS_INT_EQUAL(tc, *val, 42);
val = apr_skiplist_pop(list, NULL);
- ABTS_PTR_EQUAL(tc, val, &first_forty_two);
+ ABTS_PTR_EQUAL(tc, val, &second_forty_two);
ABTS_INT_EQUAL(tc, *val, 42);
val = apr_skiplist_peek(list);
ABTS_INT_EQUAL(tc, *val, 142);