# HG changeset patch # User Me # Date 1288581749 25200 # Node ID 3d35477a5121973e892ec926566ab46e934d3b01 # Parent 06128e387cfae5de0b654bfa1a5c9a17ff753224 This branch has replace malloc and free with VMS__malloc and VMS__free diff -r 06128e387cfa -r 3d35477a5121 DblHist.c --- a/DblHist.c Sat Oct 30 22:13:09 2010 -0700 +++ b/DblHist.c Sun Oct 31 20:22:29 2010 -0700 @@ -7,7 +7,6 @@ */ #include "Histogram.h" -#include /*This Histogram Abstract Data Type has a number of bins, the starting @@ -28,8 +27,8 @@ DblHist *hist; int i; - hist = malloc( sizeof(DblHist) ); - hist->bins = malloc( numBins * sizeof(int) ); + hist = VMS__malloc( sizeof(DblHist) ); + hist->bins = VMS__malloc( numBins * sizeof(int) ); hist->numBins = numBins; hist->binWidth = binWidth; @@ -98,3 +97,10 @@ } } + +void +freeDblHist( DblHist *hist ) + { + VMS__free( hist->bins ); + VMS__free( hist ); + } diff -r 06128e387cfa -r 3d35477a5121 FloatHist.c --- a/FloatHist.c Sat Oct 30 22:13:09 2010 -0700 +++ b/FloatHist.c Sun Oct 31 20:22:29 2010 -0700 @@ -7,8 +7,6 @@ */ #include "Histogram.h" -#include - /*This Histogram Abstract Data Type has a number of bins, the starting * value, and the width of each bin, as a float, all chosen at creation. @@ -28,8 +26,8 @@ FloatHist *hist; int i; - hist = malloc( sizeof(FloatHist) ); - hist->bins = malloc( numBins * sizeof(int) ); + hist = VMS__malloc( sizeof(FloatHist) ); + hist->bins = VMS__malloc( numBins * sizeof(int) ); hist->numBins = numBins; hist->binWidth = binWidth; @@ -98,3 +96,10 @@ } } + +void +freeDblHist( FloatHist *hist ) + { + VMS__free( hist->bins ); + VMS__free( hist ); + } diff -r 06128e387cfa -r 3d35477a5121 Histogram.c --- a/Histogram.c Sat Oct 30 22:13:09 2010 -0700 +++ b/Histogram.c Sun Oct 31 20:22:29 2010 -0700 @@ -7,7 +7,6 @@ */ #include "Histogram.h" -#include /*This Histogram Abstract Data Type has a number of bins plus a range of @@ -28,8 +27,8 @@ Histogram *hist; int i; - hist = malloc( sizeof(Histogram) ); - hist->bins = malloc( numBins * sizeof(int) ); + hist = VMS__malloc( sizeof(Histogram) ); + hist->bins = VMS__malloc( numBins * sizeof(int) ); hist->numBins = numBins; hist->binWidth = (endOfRange - startOfRange) / numBins; @@ -93,3 +92,9 @@ } } +void +freeHist( Histogram *hist ) + { + VMS__free( hist->bins ); + VMS__free( hist ); + }