comparison FloatHist.c @ 14:1fbaedaac2c7

made defualt brch pure C (no VMS__malloc..)
author Me@portablequad
date Sat, 11 Feb 2012 19:19:06 -0800
parents 060d63cb5d34
children 32489b8b763c
comparison
equal deleted inserted replaced
3:03ca2959608d 4:39b532345c04
5 * Author: seanhalle@yahoo.com 5 * Author: seanhalle@yahoo.com
6 * 6 *
7 */ 7 */
8 #include <stdio.h> 8 #include <stdio.h>
9 #include "Histogram.h" 9 #include "Histogram.h"
10 #include "../vmalloc.h"
11 10
12 /*This Histogram Abstract Data Type has a number of bins, the starting 11 /*This Histogram Abstract Data Type has a number of bins, the starting
13 * value, and the width of each bin, as a float, all chosen at creation. 12 * value, and the width of each bin, as a float, all chosen at creation.
14 * 13 *
15 *One creates a Histogram instance using the makeFloatHistogram function, then 14 *One creates a Histogram instance using the makeFloatHistogram function, then
25 makeFloatHistogram( int32 numBins, float32 startOfRange, float32 binWidth ) 24 makeFloatHistogram( int32 numBins, float32 startOfRange, float32 binWidth )
26 { 25 {
27 FloatHist *hist; 26 FloatHist *hist;
28 int i; 27 int i;
29 28
30 hist = VMS__malloc( sizeof(FloatHist) ); 29 hist = malloc( sizeof(FloatHist) );
31 hist->bins = VMS__malloc( numBins * sizeof(int) ); 30 hist->bins = malloc( numBins * sizeof(int) );
32 31
33 hist->numBins = numBins; 32 hist->numBins = numBins;
34 hist->binWidth = binWidth; 33 hist->binWidth = binWidth;
35 hist->endOfRange = startOfRange + hist->binWidth * numBins; 34 hist->endOfRange = startOfRange + hist->binWidth * numBins;
36 hist->startOfRange = startOfRange; 35 hist->startOfRange = startOfRange;
99 98
100 99
101 void 100 void
102 freeFloatHist( FloatHist *hist ) 101 freeFloatHist( FloatHist *hist )
103 { 102 {
104 VMS__free( hist->bins ); 103 free( hist->bins );
105 VMS__free( hist ); 104 free( hist );
106 } 105 }