projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
math: Avoid unneeded extra allocations for fixed-size data structures.
[pspp]
/
src
/
math
/
percentiles.c
diff --git
a/src/math/percentiles.c
b/src/math/percentiles.c
index b43fed461612d7a6f0e63ab8ddbc0fad7f549422..1b4ff136328ecdbe0ba9fb2cd1bff521519d5803 100644
(file)
--- a/
src/math/percentiles.c
+++ b/
src/math/percentiles.c
@@
-139,8
+139,6
@@
static void
destroy (struct statistic *stat)
{
struct percentile *ptl = UP_CAST (stat, struct percentile, parent.parent);
destroy (struct statistic *stat)
{
struct percentile *ptl = UP_CAST (stat, struct percentile, parent.parent);
- struct order_stats *os = &ptl->parent;
- free (os->k);
free (ptl);
}
free (ptl);
}
@@
-159,7
+157,7
@@
percentile_create (double p, double W)
ptl->w = W;
os->n_k = 2;
ptl->w = W;
os->n_k = 2;
- os->k =
xcalloc (2, sizeof (*os->k))
;
+ os->k =
ptl->k
;
os->k[0].tc = W * p;
os->k[1].tc = (W + 1.0) * p;
os->k[0].tc = W * p;
os->k[1].tc = (W + 1.0) * p;