projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid problems with G_CONST_RETURN
[pspp]
/
src
/
libpspp
/
abt.c
diff --git
a/src/libpspp/abt.c
b/src/libpspp/abt.c
index 53e66f5118f677516b9bb358bfa6acc026f762d2..ae746183021203605efa169e6989c7cc05844ec3 100644
(file)
--- a/
src/libpspp/abt.c
+++ b/
src/libpspp/abt.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* 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
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 <config.h>
#endif
#include <config.h>
#endif
-#include
<libpspp/abt.h>
+#include
"libpspp/abt.h"
#include <stdbool.h>
#include <stdbool.h>
-#include <libpspp/assertion.h>
+#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 *);
static struct abt_node **down_link (struct abt *, struct abt_node *);
static struct abt_node *skew (struct abt *, struct abt_node *);
@@
-118,7
+119,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
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;
struct abt_node *node)
{
node->down[0] = NULL;
@@
-145,8
+146,8
@@
insert_relative (struct abt *abt, struct abt_node *p, bool after,
p = p->down[dir];
dir = !after;
}
p = p->down[dir];
dir = !after;
}
-
p
->down[dir] = node;
- node->up =
p
;
+
CONST_CAST (struct abt_node *, p)
->down[dir] = node;
+ node->up =
CONST_CAST (struct abt_node *, p)
;
abt_reaugmented (abt, node);
}
abt_reaugmented (abt, node);
}
@@
-167,7
+168,7
@@
abt_insert_after (struct abt *abt,
const struct abt_node *p, struct abt_node *node)
{
assert (abt->compare == NULL);
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.
}
/* Inserts NODE before node P in ABT.
@@
-180,7
+181,7
@@
abt_insert_before (struct abt *abt,
const struct abt_node *p, struct abt_node *node)
{
assert (abt->compare == NULL);
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. */
}
/* Deletes P from ABT. */
@@
-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)
{
cmp = abt->compare (target, p, abt->aux);
if (cmp == 0)
- return
(struct abt_node *) p
;
+ return
CONST_CAST (struct abt_node *, p)
;
}
return NULL;
}
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];
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];
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)
;
}
}
}
}
@@
-350,7
+351,7
@@
void
abt_reaugmented (const struct abt *abt, struct abt_node *p)
{
for (; p != NULL; p = p->up)
abt_reaugmented (const struct abt *abt, struct abt_node *p)
{
for (; p != NULL; p = p->up)
- abt->reaugment (p,
p->down[0], p->down[1],
abt->aux);
+ abt->reaugment (p, abt->aux);
}
/* Moves P around in ABT to compensate for its key having
}
/* Moves P around in ABT to compensate for its key having
@@
-451,8
+452,8
@@
skew (struct abt *abt, struct abt_node *a)
b->up = a->up;
a->up = b;
b->up = a->up;
a->up = b;
- abt->reaugment (a, a
->down[0], a->down[1], a
bt->aux);
- abt->reaugment (b,
b->down[0], b->down[1],
abt->aux);
+ abt->reaugment (a, abt->aux);
+ abt->reaugment (b, abt->aux);
return b;
}
return b;
}
@@
-482,8
+483,8
@@
split (struct abt *abt, struct abt_node *a)
b->level++;
b->level++;
- abt->reaugment (a, a
->down[0], a->down[1], a
bt->aux);
- abt->reaugment (b,
b->down[0], b->down[1],
abt->aux);
+ abt->reaugment (a, abt->aux);
+ abt->reaugment (b, abt->aux);
return b;
}
return b;
}