--- iproute2-2.6.9/tc/normal.c 2004-08-31 14:32:14.000000000 -0400 +++ iproute2-2.6.9/tc/normal.c 2005-03-30 13:11:49.000000000 -0500 @@ -20,21 +20,16 @@ return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma)); } + int main(int argc, char **argv) { - double x, *table; int i, n; - - table = calloc(sizeof(double), TABLESIZE); - if (!table) { - fprintf(stderr, "Not enough memory\n"); - return 1; - } - + double x; + double table[TABLESIZE+1]; for (x = -10.0; x < 10.05; x += .00005) { - i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0)); + i = rint(TABLESIZE * normal(x, 0.0, 1.0)); table[i] = x; } @@ -51,6 +46,6 @@ n = 0; } } - free(table); + return 0; --- iproute2-2.6.9/tc/paretonormal.c 2004-08-31 14:32:14.000000000 -0400 +++ iproute2-2.6.9/tc/paretonormal.c 2005-08-08 16:24:41.000000000 -0400 @@ -29,7 +29,6 @@ return .5 + .5*erf((x-mu)/(sqrt(2.0)*sigma)); } - static const double a=3.0; static int @@ -50,18 +49,12 @@ int main(int argc, char **argv) { - double x; - double *table; int i,n; - - table = calloc(TABLESIZE, sizeof(double)); - if (!table) { - fprintf(stderr, "Out of memory!\n"); - exit(1); - } + double x; + double table[TABLESIZE+1]; for (x = -10.0; x < 10.05; x += .00005) { - i = (int)rint(TABLESIZE*normal(x, 0.0, 1.0)); + i = rint(TABLESIZE*normal(x, 0.0, 1.0)); table[i] = x; } printf( @@ -84,7 +77,6 @@ n = 0; } } - free(table); return 0; }