1 #include "BSprivate.h" 2 3 /*+ BSalloc_distribution - Allocate the BSdistribution data structure 4 5 Input Parameters: 6 . max - The maximum number in the distribution 7 8 Returns: 9 The allocated data structure 10 11 Notes: The distributions begin at 0 and end at max. 12 13 +*/ BSalloc_distribution(int max)14BSdistribution *BSalloc_distribution(int max) 15 { 16 BSdistribution *distr; 17 18 MY_MALLOCN(distr,(BSdistribution *),sizeof(BSdistribution),1); 19 MY_MALLOCN(distr->distribution,(int *),sizeof(int)*(max+1),2); 20 distr->max = max; 21 return(distr); 22 } 23 24 /*+ BSfree_distribution - Free the BSdistribution data structure 25 26 Input Parameters: 27 . distr - The distribution structure to be freed 28 29 Returns: 30 void 31 32 +*/ BSfree_distribution(BSdistribution * distr)33void BSfree_distribution(BSdistribution *distr) 34 { 35 MY_FREE(distr->distribution); 36 MY_FREE(distr); 37 } 38