summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-08-16 12:22:03 +0200
committerPatrick Steinhardt <ps@pks.im>2018-09-28 11:14:13 +0200
commitb78f4ab082030bc02ee2e1a51eca441bfb6f1e8f (patch)
treebb345bc7d15583de45c9c3abe071f32ab1b4f51a /script
parentd49b1365be316b6aa7c6c4c6535ff810853d0c46 (diff)
downloadlibgit2-b78f4ab082030bc02ee2e1a51eca441bfb6f1e8f.tar.gz
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.
Diffstat (limited to 'script')
0 files changed, 0 insertions, 0 deletions