apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1664962 - in /apr/apr/branches/1.5.x: tables/apr_skiplist.c test/testskiplist.c
Date Sun, 08 Mar 2015 10:23:37 GMT
Author: ylavic
Date: Sun Mar  8 10:23:36 2015
New Revision: 1664962

URL: http://svn.apache.org/r1664962
Log:
skiplist: merge r1664958 from trunk.
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.
Remove debug from r1664913.

Modified:
    apr/apr/branches/1.5.x/tables/apr_skiplist.c
    apr/apr/branches/1.5.x/test/testskiplist.c

Modified: apr/apr/branches/1.5.x/tables/apr_skiplist.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/tables/apr_skiplist.c?rev=1664962&r1=1664961&r2=1664962&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/tables/apr_skiplist.c (original)
+++ apr/apr/branches/1.5.x/tables/apr_skiplist.c Sun Mar  8 10:23:36 2015
@@ -576,7 +576,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/branches/1.5.x/test/testskiplist.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/test/testskiplist.c?rev=1664962&r1=1664961&r2=1664962&view=diff
==============================================================================
--- apr/apr/branches/1.5.x/test/testskiplist.c (original)
+++ apr/apr/branches/1.5.x/test/testskiplist.c Sun Mar  8 10:23:36 2015
@@ -306,13 +306,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);
@@ -325,22 +325,17 @@ static void skiplist_test(abts_case *tc,
     add_elem_to_skiplist(list2, t5);
     add_elem_to_skiplist(list2, t4);
     val2 = apr_skiplist_pop(list2, NULL);
-    printf("\n%d %d\n", val2->a, val2->b);
     ABTS_INT_EQUAL(tc, val2->a, 1);
     val2 = apr_skiplist_pop(list2, NULL);
-    printf("\n%d %d\n", val2->a, val2->b);
     ABTS_INT_EQUAL(tc, val2->a, 42);
     ABTS_INT_EQUAL(tc, val2->b, 1);
     val2 = apr_skiplist_pop(list2, NULL);
-    printf("\n%d %d\n", val2->a, val2->b);
     ABTS_INT_EQUAL(tc, val2->a, 42);
     ABTS_INT_EQUAL(tc, val2->b, 2);
     val2 = apr_skiplist_pop(list2, NULL);
-    printf("\n%d %d\n", val2->a, val2->b);
     ABTS_INT_EQUAL(tc, val2->a, 42);
     ABTS_INT_EQUAL(tc, val2->b, 3);
     val2 = apr_skiplist_pop(list2, NULL);
-    printf("\n%d %d\n", val2->a, val2->b);
     ABTS_INT_EQUAL(tc, val2->a, 142);
     ABTS_INT_EQUAL(tc, val2->b, 1);
 



Mime
View raw message