Changeset: a9ec6838046a for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a9ec6838046a
Modified Files:
gdk/gdk_aggr.c
Branch: default
Log Message:
Simplify
diffs (38 lines):
diff --git a/gdk/gdk_aggr.c b/gdk/gdk_aggr.c
--- a/gdk/gdk_aggr.c
+++ b/gdk/gdk_aggr.c
@@ -3376,8 +3376,8 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g,
return BATconstant(ngrp == 0 ? 0 : min, TYPE_dbl, &v, ngrp,
TRANSIENT);
}
- delta = GDKmalloc(ngrp * sizeof(dbl));
- m2 = GDKmalloc(ngrp * sizeof(dbl));
+ delta = GDKzalloc(ngrp * sizeof(dbl));
+ m2 = GDKzalloc(ngrp * sizeof(dbl));
cnts = GDKzalloc(ngrp * sizeof(BUN));
if (avgb) {
if ((*avgb = COLnew(0, TYPE_dbl, ngrp, TRANSIENT)) == NULL) {
@@ -3385,8 +3385,9 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g,
goto alloc_fail;
}
mean = (dbl *) Tloc(*avgb, 0);
+ memset(mean, 0, sizeof(dbl) * ngrp);
} else {
- mean = GDKmalloc(ngrp * sizeof(dbl));
+ mean = GDKzalloc(ngrp * sizeof(dbl));
}
if (mean == NULL || delta == NULL || m2 == NULL || cnts == NULL)
goto alloc_fail;
@@ -3396,12 +3397,6 @@ dogroupstdev(BAT **avgb, BAT *b, BAT *g,
goto alloc_fail;
dbls = (dbl *) Tloc(bn, 0);
- for (i = 0; i < ngrp; i++) {
- mean[i] = 0;
- delta[i] = 0;
- m2[i] = 0;
- }
-
if (BATtdense(g))
gids = NULL;
else
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list