Changeset e74ba77 for libcfa/src/parseconfig.cfa
- Timestamp:
- Aug 31, 2021, 1:49:09 AM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
- Children:
- 52c6891
- Parents:
- ad8072c
- git-author:
- Jacob Prud'homme <jafprudhomme@…> (07/23/21 16:27:55)
- git-committer:
- Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/parseconfig.cfa
rad8072c re74ba77 27 27 * [ char *, char * ] data; 28 28 }; 29 void ?{}( KVPairs & kvp ) with ( kvp ) { // default constructor29 void ?{}( KVPairs & kvp ) with ( kvp ) { // default constructor 30 30 size = 0; max_size = 0; data = 0p; 31 31 } 32 void ?{}( KVPairs & kvp, int size ) { // initialization32 void ?{}( KVPairs & kvp, int size ) { // initialization 33 33 kvp.[ size, max_size ] = [ 0, size ]; 34 34 kvp.data = alloc( size ); 35 35 } 36 void ^?{}( KVPairs & kvp ) with ( kvp ) { // destructor 36 /* 37 void ?{}( KVPairs & kvp, KVPairs val ) with( val ) { // copy, deep 38 kvp.[ size, max_size ] = [ size, max_size ]; 39 kvp.data = alloc( size, data ); 40 } 41 */ 42 void ^?{}( KVPairs & kvp ) with ( kvp ) { // destructor 37 43 free( data ); 38 44 size = 0; max_size = 0; data = 0p; … … 61 67 // Parse configuration from a file formatted in shell style 62 68 KVPairs & parse_shell_config_format( const char * config_file, size_t num_entries ) { 63 KVPairs kv_pairs= { num_entries };69 * KVPairs kv_pairs;// = { num_entries }; 64 70 65 71 ifstream in; … … 74 80 in | value; 75 81 76 add_kv_pair( kv_pairs, key, value );82 add_kv_pair( *kv_pairs, key, value ); 77 83 78 84 if ( fail( in ) ) break; … … 84 90 close( in ); 85 91 86 return kv_pairs;92 return *kv_pairs; 87 93 } 88 94
Note: See TracChangeset
for help on using the changeset viewer.