X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fll.c;h=21f8dd8870a2fc96b48ccfd49c228aeb7bc3db21;hb=93ec42221da8b677420bf11435e0d24d0503601b;hp=443f80fdd57243b18b9315d3cc1576205eb68f4b;hpb=f5c108becd49d78f4898cab11352291f5689d24e;p=pspp diff --git a/src/libpspp/ll.c b/src/libpspp/ll.c index 443f80fdd5..21f8dd8870 100644 --- a/src/libpspp/ll.c +++ b/src/libpspp/ll.c @@ -1,20 +1,18 @@ -/* PSPP - computes sample statistics. - Copyright (C) 2006 Free Software Foundation, Inc. +/* PSPP - a program for statistical analysis. + Copyright (C) 2006, 2009, 2011 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 . */ /* Embedded, circular doubly linked list. */ @@ -30,7 +28,8 @@ #include #endif -#include +#include "libpspp/ll.h" + #include /* Returns the number of nodes in LIST (not counting the null @@ -171,7 +170,7 @@ ll_find_equal (const struct ll *r0, const struct ll *r1, for (x = r0; x != r1; x = ll_next (x)) if (compare (x, target, aux) == 0) break; - return (struct ll *) x; + return CONST_CAST (struct ll *, x); } /* Returns the first node in R0...R1 for which PREDICATE returns @@ -187,7 +186,7 @@ ll_find_if (const struct ll *r0, const struct ll *r1, for (x = r0; x != r1; x = ll_next (x)) if (predicate (x, aux)) break; - return (struct ll *) x; + return CONST_CAST (struct ll *, x); } /* Compares each pair of adjacent nodes in R0...R1 @@ -205,10 +204,10 @@ ll_find_adjacent_equal (const struct ll *r0, const struct ll *r1, for (x = r0, y = ll_next (x); y != r1; x = y, y = ll_next (y)) if (compare (x, y, aux) == 0) - return (struct ll *) x; + return CONST_CAST (struct ll *, x); } - return (struct ll *) r1; + return CONST_CAST (struct ll *, r1); } /* Returns the number of nodes in R0...R1. @@ -274,7 +273,7 @@ ll_max (const struct ll *r0, const struct ll *r1, if (compare (x, max, aux) > 0) max = x; } - return (struct ll *) max; + return CONST_CAST (struct ll *, max); } /* Returns the least node in R0...R1 according to COMPARE given @@ -293,7 +292,7 @@ ll_min (const struct ll *r0, const struct ll *r1, if (compare (x, min, aux) < 0) min = x; } - return (struct ll *) min; + return CONST_CAST (struct ll *, min); } /* Lexicographically compares A0...A1 to B0...B1. @@ -476,7 +475,7 @@ ll_find_run (const struct ll *r0, const struct ll *r1, while (r0 != r1 && compare (ll_prev (r0), r0, aux) <= 0); } - return (struct ll *) r0; + return CONST_CAST (struct ll *, r0); } /* Merges B0...B1 into A0...A1 according to COMPARE given @@ -683,6 +682,6 @@ ll_find_partition (const struct ll *r0, const struct ll *r1, if (predicate (x, aux)) return NULL; - return (struct ll *) partition; + return CONST_CAST (struct ll *, partition); }