• Show log

    Commit

  • Hash : b78f4ab0
    Author : Patrick Steinhardt
    Date : 2018-08-16T12:22:03

    config_entries: refactor entries iterator memory ownership
    
    Right now, the config file code requires us to pass in its backend to
    the config entry iterator. This is required with the current code, as
    the config file backend will first create a read-only snapshot which is
    then passed to the iterator just for that purpose. So after the iterator
    is getting free'd, the code needs to make sure that the snapshot gets
    free'd, as well.
    
    By now, though, we can easily refactor the code to be more efficient and
    remove the reverse dependency from iterator to backend. Instead of
    creating a read-only snapshot (which also requires us to re-parse the
    complete configuration file), we can simply duplicate the config entries
    and pass those to the iterator. Like that, the iterator only needs to
    make sure to free the duplicated config entries, which is trivial to do
    and clears up memory ownership by a lot.