projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
category filtering works
[pspp]
/
src
/
libpspp
/
ll.c
diff --git
a/src/libpspp/ll.c
b/src/libpspp/ll.c
index b9d595bc97a00212e9ebc1c156a1a01f75ed1556..887b58039e352e32fa2b0e5ee9b9be51be85f28f 100644
(file)
--- a/
src/libpspp/ll.c
+++ b/
src/libpspp/ll.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 2006 Free Software Foundation, Inc.
+ 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
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,8
+28,8
@@
#include <config.h>
#endif
#include <config.h>
#endif
-#include
<libpspp/ll.h>
-#include <assert.h>
+#include
"libpspp/ll.h"
+
/* Returns the number of nodes in LIST (not counting the null
node). Executes in O(n) time in the length of the list. */
/* Returns the number of nodes in LIST (not counting the null
node). Executes in O(n) time in the length of the list. */
@@
-121,7
+121,7
@@
ll_remove_equal (struct ll *r0, struct ll *r1, struct ll *target,
size_t count;
count = 0;
size_t count;
count = 0;
- for (x = r0; x != r1;
)
+ for (x = r0; x != r1;)
if (compare (x, target, aux) == 0)
{
x = ll_remove (x);
if (compare (x, target, aux) == 0)
{
x = ll_remove (x);
@@
-144,7
+144,7
@@
ll_remove_if (struct ll *r0, struct ll *r1,
size_t count;
count = 0;
size_t count;
count = 0;
- for (x = r0; x != r1;
)
+ for (x = r0; x != r1;)
if (predicate (x, aux))
{
x = ll_remove (x);
if (predicate (x, aux))
{
x = ll_remove (x);
@@
-169,7
+169,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;
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
}
/* Returns the first node in R0...R1 for which PREDICATE returns
@@
-185,7
+185,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;
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
}
/* Compares each pair of adjacent nodes in R0...R1
@@
-203,10
+203,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)
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.
}
/* Returns the number of nodes in R0...R1.
@@
-272,7
+272,7
@@
ll_max (const struct ll *r0, const struct ll *r1,
if (compare (x, max, aux) > 0)
max = x;
}
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
}
/* Returns the least node in R0...R1 according to COMPARE given
@@
-291,7
+291,7
@@
ll_min (const struct ll *r0, const struct ll *r1,
if (compare (x, min, aux) < 0)
min = x;
}
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.
}
/* Lexicographically compares A0...A1 to B0...B1.
@@
-434,7
+434,7
@@
void
ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
{
struct ll *pre_r0;
ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
{
struct ll *pre_r0;
- size_t output_run_
cnt
;
+ size_t output_run_
len
;
if (r0 == r1 || ll_next (r0) == r1)
return;
if (r0 == r1 || ll_next (r0) == r1)
return;
@@
-443,7
+443,7
@@
ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
do
{
struct ll *a0 = ll_next (pre_r0);
do
{
struct ll *a0 = ll_next (pre_r0);
- for (output_run_
cnt = 1; ; output_run_cnt
++)
+ for (output_run_
len = 1; ; output_run_len
++)
{
struct ll *a1 = ll_find_run (a0, r1, compare, aux);
struct ll *a2 = ll_find_run (a1, r1, compare, aux);
{
struct ll *a1 = ll_find_run (a0, r1, compare, aux);
struct ll *a2 = ll_find_run (a1, r1, compare, aux);
@@
-453,7
+453,7
@@
ll_sort (struct ll *r0, struct ll *r1, ll_compare_func *compare, void *aux)
a0 = ll_merge (a0, a1, a1, a2, compare, aux);
}
}
a0 = ll_merge (a0, a1, a1, a2, compare, aux);
}
}
- while (output_run_
cnt
> 1);
+ while (output_run_
len
> 1);
}
/* Finds the extent of a run of nodes of increasing value
}
/* Finds the extent of a run of nodes of increasing value
@@
-474,7
+474,7
@@
ll_find_run (const struct ll *r0, const struct ll *r1,
while (r0 != r1 && compare (ll_prev (r0), r0, aux) <= 0);
}
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
}
/* Merges B0...B1 into A0...A1 according to COMPARE given
@@
-681,6
+681,6
@@
ll_find_partition (const struct ll *r0, const struct ll *r1,
if (predicate (x, aux))
return NULL;
if (predicate (x, aux))
return NULL;
- return
(struct ll *) partition
;
+ return
CONST_CAST (struct ll *, partition)
;
}
\f
}
\f