Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AB45C17A67 for ; Sun, 8 Mar 2015 10:23:37 +0000 (UTC) Received: (qmail 39551 invoked by uid 500); 8 Mar 2015 10:23:37 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 39494 invoked by uid 500); 8 Mar 2015 10:23:37 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 39484 invoked by uid 99); 8 Mar 2015 10:23:37 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 08 Mar 2015 10:23:37 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 60AB2AC006E for ; Sun, 8 Mar 2015 10:23:37 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@apr.apache.org From: ylavic@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150308102337.60AB2AC006E@hades.apache.org> 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);