Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > Histogram
comparison Histogram.c @ 20:cd8275f62ee1
added pure C brch
| author | Me@portablequad |
|---|---|
| date | Mon, 13 Feb 2012 12:57:42 -0800 |
| parents | f4d96eaf374a |
| children |
comparison
equal
deleted
inserted
replaced
| 12:f182ad11c6fa | 13:e3dc9ea85646 |
|---|---|
| 32 { | 32 { |
| 33 Histogram *hist; | 33 Histogram *hist; |
| 34 int32 i; | 34 int32 i; |
| 35 | 35 |
| 36 | 36 |
| 37 hist = VMS_int__malloc( sizeof(Histogram) ); | 37 hist = malloc( sizeof(Histogram) ); |
| 38 hist->bins = VMS_int__malloc( numBins * sizeof(int32) ); | 38 hist->bins = malloc( numBins * sizeof(int32) ); |
| 39 | 39 |
| 40 hist->numBins = numBins; | 40 hist->numBins = numBins; |
| 41 hist->binWidth = (endOfRange - startOfRange) / numBins; | 41 hist->binWidth = (endOfRange - startOfRange) / numBins; |
| 42 hist->endOfRange = startOfRange + hist->binWidth * numBins; | 42 hist->endOfRange = startOfRange + hist->binWidth * numBins; |
| 43 hist->startOfRange = startOfRange; | 43 hist->startOfRange = startOfRange; |
| 69 char *name ) | 69 char *name ) |
| 70 | 70 |
| 71 { | 71 { |
| 72 Histogram *hist; | 72 Histogram *hist; |
| 73 | 73 |
| 74 hist = VMS_int__malloc( sizeof(Histogram) ); | 74 hist = malloc( sizeof(Histogram) ); |
| 75 hist->bins = VMS_int__malloc( numBins * sizeof(int32) ); | 75 hist->bins = malloc( numBins * sizeof(int32) ); |
| 76 | 76 |
| 77 makeHist_helper( hist, numBins, startOfRange, binWidth,VMS_int__strDup(name)); | 77 makeHist_helper( hist, numBins, startOfRange, binWidth,strDup(name)); |
| 78 | 78 |
| 79 return hist; | 79 return hist; |
| 80 } | 80 } |
| 81 | 81 |
| 82 Histogram * | 82 Histogram * |
| 343 } | 343 } |
| 344 | 344 |
| 345 void | 345 void |
| 346 freeHist( Histogram *hist ) | 346 freeHist( Histogram *hist ) |
| 347 { | 347 { |
| 348 VMS_int__free( hist->bins ); | |
| 349 VMS_int__free( hist->name ); | |
| 350 VMS_int__free( hist ); | |
| 351 } | |
| 352 void | |
| 353 freeHistExt( Histogram *hist ) | |
| 354 { | |
| 355 free( hist->bins ); | 348 free( hist->bins ); |
| 356 free( hist->name ); | 349 free( hist->name ); |
| 357 free( hist ); | 350 free( hist ); |
| 358 } | 351 } |
| 352 void | |
| 353 freeHistExt( Histogram *hist ) | |
| 354 { | |
| 355 free( hist->bins ); | |
| 356 free( hist->name ); | |
| 357 free( hist ); | |
| 358 } |
