X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fabt.c;h=c06047b4abdbb8e128910a17049f972893abd295;hb=14319bf7eda3adf7be9003fd51eae4b82874beee;hp=74b2ceb387f54d04e669cfbadb7eb4e7589c89a3;hpb=f404544337964f80bb2d1fee5acb147f7023bc08;p=pspp diff --git a/src/libpspp/abt.c b/src/libpspp/abt.c index 74b2ceb387..c06047b4ab 100644 --- a/src/libpspp/abt.c +++ b/src/libpspp/abt.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007, 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 @@ -28,11 +28,12 @@ #include #endif -#include +#include "libpspp/abt.h" #include -#include +#include "libpspp/cast.h" +#include "libpspp/assertion.h" static struct abt_node **down_link (struct abt *, struct abt_node *); static struct abt_node *skew (struct abt *, struct abt_node *); @@ -145,8 +146,8 @@ insert_relative (struct abt *abt, const struct abt_node *p, bool after, p = p->down[dir]; dir = !after; } - ((struct abt_node *) p)->down[dir] = node; - node->up = (struct abt_node *) p; + CONST_CAST (struct abt_node *, p)->down[dir] = node; + node->up = CONST_CAST (struct abt_node *, p); abt_reaugmented (abt, node); } @@ -280,7 +281,7 @@ abt_find (const struct abt *abt, const struct abt_node *target) { cmp = abt->compare (target, p, abt->aux); if (cmp == 0) - return (struct abt_node *) p; + return CONST_CAST (struct abt_node *, p); } return NULL; @@ -307,7 +308,7 @@ abt_next (const struct abt *abt, const struct abt_node *p) p = p->down[1]; while (p->down[0] != NULL) p = p->down[0]; - return (struct abt_node *) p; + return CONST_CAST (struct abt_node *, p); } } @@ -332,7 +333,7 @@ abt_prev (const struct abt *abt, const struct abt_node *p) p = p->down[0]; while (p->down[1] != NULL) p = p->down[1]; - return (struct abt_node *) p; + return CONST_CAST (struct abt_node *, p); } }