Changeset 02a22a2 for libcfa


Ignore:
Timestamp:
Aug 31, 2021, 1:49:09 AM (3 years ago)
Author:
Jacob Prud'homme <jafprudhomme@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, pthread-emulation, qualifiedEnum
Children:
ba61cd9
Parents:
98d6b744
git-author:
Jacob Prud'homme <jafprudhomme@…> (07/27/21 12:38:33)
git-committer:
Jacob Prud'homme <jafprudhomme@…> (08/31/21 01:49:09)
Message:

Reverted to using reference to KVPairs

This will have to be changed in the future as we are returning a
stack-allocated value out of scope

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/parseconfig.cfa

    r98d6b744 r02a22a2  
    4545}
    4646
    47 void add_kv_pair( KVPairs kv_pairs, char * k, char * v ) with ( kv_pairs ) {
     47void add_kv_pair( KVPairs & kv_pairs, char * k, char * v ) with ( kv_pairs ) {
    4848        if ( size == max_size ) {
    4949                max_size *= 2;
     
    6767// Parse configuration from a file formatted in shell style
    6868KVPairs & parse_shell_config_format( const char * config_file, size_t num_entries ) {
    69         * KVPairs kv_pairs;// = { num_entries };
     69        // * KVPairs kv_pairs;
     70        KVPairs kv_pairs = { num_entries };
    7071
    7172        ifstream in;
     
    8081                        in | value;
    8182
    82                         add_kv_pair( *kv_pairs, key, value );
     83                        add_kv_pair( kv_pairs, key, value );
    8384
    8485                  if ( fail( in ) ) break;
     
    9192        close( in );
    9293
    93         return *kv_pairs;
     94        return kv_pairs;
    9495}
    9596
Note: See TracChangeset for help on using the changeset viewer.