diff options
author | Edward Thomson <ethomson@microsoft.com> | 2015-02-19 10:05:33 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@microsoft.com> | 2015-02-19 10:05:33 -0500 |
commit | d4cf167515d3ed7b27c1358fc2e19b9caf66e8ad (patch) | |
tree | ecb73c7055ea0a319f72996517f966c904bd5100 /src/attr.c | |
parent | b49edddcd0af70caee7eb4905dc26199adccabfd (diff) | |
download | libgit2-d4cf167515d3ed7b27c1358fc2e19b9caf66e8ad.tar.gz |
buffer: introduce git_buf_attach_notowned
Provide a convenience function that creates a buffer that can be provided
to callers but will not be freed via `git_buf_free`, so the buffer
creator maintains the allocation lifecycle of the buffer's contents.
Diffstat (limited to 'src/attr.c')
-rw-r--r-- | src/attr.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/attr.c b/src/attr.c index 44593da81..38420807a 100644 --- a/src/attr.c +++ b/src/attr.c @@ -282,9 +282,8 @@ static int system_attr_file( * a consumer. This allows them to treat this as a regular `git_buf`, * but their call to `git_buf_free` will not attempt to free it. */ - out->ptr = attr_session->sysdir.ptr; - out->size = attr_session->sysdir.size; - out->asize = 0; + git_buf_attach_notowned( + out, attr_session->sysdir.ptr, attr_session->sysdir.size); return 0; } |