X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Flibpspp%2Fabt.c;h=74b2ceb387f54d04e669cfbadb7eb4e7589c89a3;hb=9de93455099eff93bb2d8b730eea8413e7ab1121;hp=12da494a025fbc81c003b788b88aac9ca76c1669;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp-builds.git diff --git a/src/libpspp/abt.c b/src/libpspp/abt.c index 12da494a..74b2ceb3 100644 --- a/src/libpspp/abt.c +++ b/src/libpspp/abt.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. +/* PSPP - a program for statistical analysis. Copyright (C) 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License as - published by the Free Software Foundation; either version 2 of the - License, or (at your option) any later version. + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - This program is distributed in the hope that it will be useful, but - WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301, USA. */ + along with this program. If not, see . */ /* Augmented binary tree (ABT) data structure. */ @@ -120,7 +118,7 @@ abt_insert (struct abt *abt, struct abt_node *node) the tree, if AFTER is true, or the last node, if AFTER is false. */ static inline void -insert_relative (struct abt *abt, struct abt_node *p, bool after, +insert_relative (struct abt *abt, const struct abt_node *p, bool after, struct abt_node *node) { node->down[0] = NULL; @@ -147,8 +145,8 @@ insert_relative (struct abt *abt, struct abt_node *p, bool after, p = p->down[dir]; dir = !after; } - p->down[dir] = node; - node->up = p; + ((struct abt_node *) p)->down[dir] = node; + node->up = (struct abt_node *) p; abt_reaugmented (abt, node); } @@ -169,7 +167,7 @@ abt_insert_after (struct abt *abt, const struct abt_node *p, struct abt_node *node) { assert (abt->compare == NULL); - insert_relative (abt, (struct abt_node *) p, true, node); + insert_relative (abt, p, true, node); } /* Inserts NODE before node P in ABT. @@ -182,7 +180,7 @@ abt_insert_before (struct abt *abt, const struct abt_node *p, struct abt_node *node) { assert (abt->compare == NULL); - insert_relative (abt, (struct abt_node *) p, false, node); + insert_relative (abt, p, false, node); } /* Deletes P from ABT. */