Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > ParamHelper
diff ParamBag.c @ 19:740df4b46535
new branch -- for universal -- changed malloc and free -- do PR__start before use
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Tue, 23 Jul 2013 07:20:05 -0700 |
| parents | c6544bc64a7c |
| children | 5837ad792168 |
line diff
1.1 --- a/ParamBag.c Wed Jun 12 15:51:30 2013 -0700 1.2 +++ b/ParamBag.c Tue Jul 23 07:20:05 2013 -0700 1.3 @@ -14,6 +14,7 @@ 1.4 #include <stdlib.h> 1.5 1.6 #include "Param.h" 1.7 +#include "PR__common_includes/Services_offered_by_PR/Memory_Handling/vmalloc__wrapper_library.h" 1.8 1.9 void freeParamStruc( ParamStruc * param ); 1.10 void freeParamBagHashEntry( ParamBagHashEntry *entry ); 1.11 @@ -25,8 +26,8 @@ 1.12 ParamBag * 1.13 makeParamBag() 1.14 { ParamBag * retBag; 1.15 - retBag = malloc( sizeof( ParamBag ) ); 1.16 - retBag->entries = malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); 1.17 + retBag = PR__malloc( sizeof( ParamBag ) ); 1.18 + retBag->entries = PR__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); 1.19 retBag->bagSz = PARAM_BAG_HASHSIZE; 1.20 nullOutParamBagHashEntries( retBag ); 1.21 1.22 @@ -81,7 +82,7 @@ 1.23 hashEntry = lookupKeyInHash( key, bag ); 1.24 if( hashEntry == NULL ) 1.25 { hashIdx = hashKey( key, bag->bagSz ); 1.26 - hashEntry = (ParamBagHashEntry*) malloc( sizeof( ParamBagHashEntry ) ); 1.27 + hashEntry = (ParamBagHashEntry*) PR__malloc( sizeof( ParamBagHashEntry ) ); 1.28 if( hashEntry == NULL ) return 0; 1.29 hashEntry->key = strdup( key ); 1.30 if( hashEntry->key == NULL ) return 0; 1.31 @@ -119,20 +120,20 @@ 1.32 freeParamBagHashEntry( ParamBagHashEntry *entry ) 1.33 { 1.34 freeParamStruc( entry->param ); 1.35 - free( entry->key ); //was malloc'd above, so free it 1.36 - free( entry ); 1.37 + PR__free( entry->key ); //was malloc'd above, so free it 1.38 + PR__free( entry ); 1.39 } 1.40 1.41 void 1.42 freeParamStruc( ParamStruc * param ) 1.43 - { if( param->type == STRING_PARAM_TYPE ) free( param->strValue ); 1.44 - free( param ); 1.45 + { if( param->type == STRING_PARAM_TYPE ) PR__free( param->strValue ); 1.46 + PR__free( param ); 1.47 } 1.48 1.49 ParamStruc * 1.50 makeParamStruc() 1.51 { ParamStruc *retStruc; 1.52 - retStruc = malloc( sizeof( ParamStruc ) ); 1.53 + retStruc = PR__malloc( sizeof( ParamStruc ) ); 1.54 retStruc->floatValue = 0.0; 1.55 retStruc->intValue = 0; 1.56 retStruc->strValue = NULL; 1.57 @@ -165,7 +166,7 @@ 1.58 } break; 1.59 case 's': 1.60 { retParam->type = STRING_PARAM_TYPE; 1.61 - retParam->strValue = malloc( strlen(value) + 1); 1.62 + retParam->strValue = PR__malloc( strlen(value) + 1); 1.63 strcpy( retParam->strValue, value ); 1.64 removeEndWhtSpaceFromStr( retParam->strValue ); 1.65 } break;
