Mercurial > cgi-bin > hgwebdir.cgi > VMS > C_Libraries > ParamHelper
changeset 9:b80587574901 MC_shared
fixed #include and changed VMS__malloc to VMS_WL__malloc
| author | Me@portablequad |
|---|---|
| date | Sun, 12 Feb 2012 01:06:02 -0800 |
| parents | 1bf28dddc45f |
| children | 4d981e9848b1 |
| files | ParamBag.c ReadParamsFromFile.c |
| diffstat | 2 files changed, 16 insertions(+), 16 deletions(-) [+] |
line diff
1.1 --- a/ParamBag.c Sat Feb 11 20:08:58 2012 -0800 1.2 +++ b/ParamBag.c Sun Feb 12 01:06:02 2012 -0800 1.3 @@ -13,7 +13,7 @@ 1.4 #include <stdio.h> 1.5 #include <stdlib.h> 1.6 1.7 -#include "Param.h" 1.8 +#include "ParamBag.h" 1.9 1.10 void freeParamStruc( ParamStruc * param ); 1.11 void freeParamBagHashEntry( ParamBagHashEntry *entry ); 1.12 @@ -24,8 +24,8 @@ 1.13 ParamBag * 1.14 makeParamBag() 1.15 { ParamBag * retBag; 1.16 - retBag = VMS__malloc( sizeof( ParamBag ) ); 1.17 - retBag->entries = VMS__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); 1.18 + retBag = VMS_WL__malloc( sizeof( ParamBag ) ); 1.19 + retBag->entries = VMS_WL__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); 1.20 retBag->bagSz = PARAM_BAG_HASHSIZE; 1.21 nullOutParamBagHashEntries( retBag ); 1.22 1.23 @@ -80,7 +80,7 @@ 1.24 hashEntry = lookupKeyInHash( key, bag ); 1.25 if( hashEntry == NULL ) 1.26 { hashIdx = hashKey( key, bag->bagSz ); 1.27 - hashEntry = (ParamBagHashEntry*) VMS__malloc( sizeof( ParamBagHashEntry ) ); 1.28 + hashEntry = (ParamBagHashEntry*) VMS_WL__malloc( sizeof( ParamBagHashEntry ) ); 1.29 if( hashEntry == NULL ) return 0; 1.30 hashEntry->key = strdup( key ); 1.31 if( hashEntry->key == NULL ) return 0; 1.32 @@ -118,20 +118,20 @@ 1.33 freeParamBagHashEntry( ParamBagHashEntry *entry ) 1.34 { 1.35 freeParamStruc( entry->param ); 1.36 - VMS__free( entry->key ); //was malloc'd above, so free it 1.37 - VMS__free( entry ); 1.38 + VMS_WL__free( entry->key ); //was malloc'd above, so free it 1.39 + VMS_WL__free( entry ); 1.40 } 1.41 1.42 void 1.43 freeParamStruc( ParamStruc * param ) 1.44 - { if( param->type == STRING_PARAM_TYPE ) VMS__free( param->strValue ); 1.45 - VMS__free( param ); 1.46 + { if( param->type == STRING_PARAM_TYPE ) VMS_WL__free( param->strValue ); 1.47 + VMS_WL__free( param ); 1.48 } 1.49 1.50 ParamStruc * 1.51 makeParamStruc() 1.52 { ParamStruc *retStruc; 1.53 - retStruc = VMS__malloc( sizeof( ParamStruc ) ); 1.54 + retStruc = VMS_WL__malloc( sizeof( ParamStruc ) ); 1.55 retStruc->floatValue = 0.0; 1.56 retStruc->intValue = 0; 1.57 retStruc->strValue = NULL; 1.58 @@ -164,7 +164,7 @@ 1.59 } break; 1.60 case 's': 1.61 { retParam->type = STRING_PARAM_TYPE; 1.62 - retParam->strValue = VMS__malloc( strlen(value) + 1); 1.63 + retParam->strValue = VMS_WL__malloc( strlen(value) + 1); 1.64 strcpy( retParam->strValue, value ); 1.65 removeEndWhtSpaceFromStr( retParam->strValue ); 1.66 } break;
2.1 --- a/ReadParamsFromFile.c Sat Feb 11 20:08:58 2012 -0800 2.2 +++ b/ReadParamsFromFile.c Sun Feb 12 01:06:02 2012 -0800 2.3 @@ -8,7 +8,7 @@ 2.4 #include <stdlib.h> 2.5 #include <string.h> 2.6 2.7 -#include "Param.h" 2.8 +#include "ParamBag.h" 2.9 2.10 ParamStruc * makeParamFromStrs( char * type, char *value ); 2.11 2.12 @@ -16,13 +16,13 @@ 2.13 2.14 /*Copied from gnu's win32 lib 2.15 */ 2.16 - ssize_t 2.17 +ssize_t 2.18 getline( char **lineptr, size_t *n, FILE *stream ) 2.19 { 2.20 if ( lineptr == NULL || n == NULL) return -1; 2.21 if (*lineptr == NULL || *n == 0) 2.22 { *n = 500; //max length of line in a config file 2.23 - *lineptr = (char *) VMS__malloc( *n ); 2.24 + *lineptr = (char *) VMS_WL__malloc( *n ); 2.25 if (*lineptr == NULL) return -1; 2.26 } 2.27 if( fgets( *lineptr, *n, stream ) ) 2.28 @@ -31,7 +31,7 @@ 2.29 return -1; 2.30 } 2.31 2.32 - void 2.33 +void 2.34 readParamFileIntoBag( char *paramFileName, ParamBag * bag ) 2.35 { 2.36 size_t lineSz = 0; 2.37 @@ -43,7 +43,7 @@ 2.38 char* paramValue;// = malloc( 500 ); //max of 500 chars in value 2.39 2.40 lineSz = 500; //max length of line in a config file 2.41 - line = (char *) VMS__malloc( lineSz ); 2.42 + line = (char *) VMS_WL__malloc( lineSz ); 2.43 if( line == NULL ) 2.44 { printf( "\nIn readParamFileIntoBag: no mem for line\n" ); 2.45 return; 2.46 @@ -106,6 +106,6 @@ 2.47 } 2.48 } 2.49 } 2.50 - VMS__free( line ); 2.51 + VMS_WL__free( line ); 2.52 } 2.53
