# HG changeset patch # User Me@portablequad # Date 1329037562 28800 # Node ID b8058757490126668494717332ac52c6bbcbcfda # Parent 1bf28dddc45ffc355f3c5c058ed155f1e49cdd4c fixed #include and changed VMS__malloc to VMS_WL__malloc diff -r 1bf28dddc45f -r b80587574901 ParamBag.c --- a/ParamBag.c Sat Feb 11 20:08:58 2012 -0800 +++ b/ParamBag.c Sun Feb 12 01:06:02 2012 -0800 @@ -13,7 +13,7 @@ #include #include -#include "Param.h" +#include "ParamBag.h" void freeParamStruc( ParamStruc * param ); void freeParamBagHashEntry( ParamBagHashEntry *entry ); @@ -24,8 +24,8 @@ ParamBag * makeParamBag() { ParamBag * retBag; - retBag = VMS__malloc( sizeof( ParamBag ) ); - retBag->entries = VMS__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); + retBag = VMS_WL__malloc( sizeof( ParamBag ) ); + retBag->entries = VMS_WL__malloc( PARAM_BAG_HASHSIZE * sizeof( ParamBagHashEntry *) ); retBag->bagSz = PARAM_BAG_HASHSIZE; nullOutParamBagHashEntries( retBag ); @@ -80,7 +80,7 @@ hashEntry = lookupKeyInHash( key, bag ); if( hashEntry == NULL ) { hashIdx = hashKey( key, bag->bagSz ); - hashEntry = (ParamBagHashEntry*) VMS__malloc( sizeof( ParamBagHashEntry ) ); + hashEntry = (ParamBagHashEntry*) VMS_WL__malloc( sizeof( ParamBagHashEntry ) ); if( hashEntry == NULL ) return 0; hashEntry->key = strdup( key ); if( hashEntry->key == NULL ) return 0; @@ -118,20 +118,20 @@ freeParamBagHashEntry( ParamBagHashEntry *entry ) { freeParamStruc( entry->param ); - VMS__free( entry->key ); //was malloc'd above, so free it - VMS__free( entry ); + VMS_WL__free( entry->key ); //was malloc'd above, so free it + VMS_WL__free( entry ); } void freeParamStruc( ParamStruc * param ) - { if( param->type == STRING_PARAM_TYPE ) VMS__free( param->strValue ); - VMS__free( param ); + { if( param->type == STRING_PARAM_TYPE ) VMS_WL__free( param->strValue ); + VMS_WL__free( param ); } ParamStruc * makeParamStruc() { ParamStruc *retStruc; - retStruc = VMS__malloc( sizeof( ParamStruc ) ); + retStruc = VMS_WL__malloc( sizeof( ParamStruc ) ); retStruc->floatValue = 0.0; retStruc->intValue = 0; retStruc->strValue = NULL; @@ -164,7 +164,7 @@ } break; case 's': { retParam->type = STRING_PARAM_TYPE; - retParam->strValue = VMS__malloc( strlen(value) + 1); + retParam->strValue = VMS_WL__malloc( strlen(value) + 1); strcpy( retParam->strValue, value ); removeEndWhtSpaceFromStr( retParam->strValue ); } break; diff -r 1bf28dddc45f -r b80587574901 ReadParamsFromFile.c --- a/ReadParamsFromFile.c Sat Feb 11 20:08:58 2012 -0800 +++ b/ReadParamsFromFile.c Sun Feb 12 01:06:02 2012 -0800 @@ -8,7 +8,7 @@ #include #include -#include "Param.h" +#include "ParamBag.h" ParamStruc * makeParamFromStrs( char * type, char *value ); @@ -16,13 +16,13 @@ /*Copied from gnu's win32 lib */ - ssize_t +ssize_t getline( char **lineptr, size_t *n, FILE *stream ) { if ( lineptr == NULL || n == NULL) return -1; if (*lineptr == NULL || *n == 0) { *n = 500; //max length of line in a config file - *lineptr = (char *) VMS__malloc( *n ); + *lineptr = (char *) VMS_WL__malloc( *n ); if (*lineptr == NULL) return -1; } if( fgets( *lineptr, *n, stream ) ) @@ -31,7 +31,7 @@ return -1; } - void +void readParamFileIntoBag( char *paramFileName, ParamBag * bag ) { size_t lineSz = 0; @@ -43,7 +43,7 @@ char* paramValue;// = malloc( 500 ); //max of 500 chars in value lineSz = 500; //max length of line in a config file - line = (char *) VMS__malloc( lineSz ); + line = (char *) VMS_WL__malloc( lineSz ); if( line == NULL ) { printf( "\nIn readParamFileIntoBag: no mem for line\n" ); return; @@ -106,6 +106,6 @@ } } } - VMS__free( line ); + VMS_WL__free( line ); }