]> git.proxmox.com Git - libgit2.git/commit - tests/libgit2/config/rename.c
config: borrow refcounted references
authorCarlos Martín Nieto <cmn@dwim.me>
Sun, 21 Dec 2014 15:31:03 +0000 (15:31 +0000)
committerCarlos Martín Nieto <cmn@dwim.me>
Tue, 3 Mar 2015 17:35:12 +0000 (18:35 +0100)
commit9a97f49e3aa15edc479fc590f4b28fc44c155c40
treeb85de2d396b9d0d408f688212c0cdc74347ea7b3
parent76f034180aee96fcc1fffd5267ccbc6ada68482a
config: borrow refcounted references

This changes the get_entry() method to return a refcounted version of
the config entry, which you have to free when you're done.

This allows us to avoid freeing the memory in which the entry is stored
on a refresh, which may happen at any time for a live config.

For this reason, get_string() has been forbidden on live configs and a
new function get_string_buf() has been added, which stores the string in
a git_buf which the user then owns.

The functions which parse the string value takea advantage of the
borrowing to parse safely and then release the entry.
35 files changed:
CHANGELOG.md
include/git2/config.h
include/git2/sys/config.h
src/attrcache.c
src/branch.c
src/checkout.c
src/config.c
src/config.h
src/config_cache.c
src/config_file.c
src/config_file.h
src/diff.c
src/diff_driver.c
src/remote.c
src/repository.c
tests/clone/nonetwork.c
tests/config/config_helpers.c
tests/config/configlevel.c
tests/config/global.c
tests/config/include.c
tests/config/new.c
tests/config/read.c
tests/config/rename.c
tests/config/stress.c
tests/config/validkeyname.c
tests/config/write.c
tests/network/remote/remotes.c
tests/refs/branches/move.c
tests/refs/branches/upstream.c
tests/repo/init.c
tests/repo/setters.c
tests/submodule/add.c
tests/submodule/init.c
tests/submodule/modify.c
tests/submodule/repository_init.c