diff options
author | Russell Belfer <arrbee@arrbee.com> | 2011-11-29 23:45:17 -0800 |
---|---|---|
committer | Russell Belfer <arrbee@arrbee.com> | 2011-11-29 23:45:17 -0800 |
commit | 309113c984c1f3157659dc1174e5d4218f610ae4 (patch) | |
tree | 63fb56773ea31214c1107dfa33dbecceec2b4c1c /src/commit.c | |
parent | 7df41387f5d09308acda0d4b54eccc1431c71610 (diff) | |
download | libgit2-309113c984c1f3157659dc1174e5d4218f610ae4.tar.gz |
Make initial value of git_buf ptr always be a valid empty string.
Taking a page from core git's strbuf, this introduces git_buf_initbuf
which is an empty string that is used to initialize the git_buf ptr
value even for new buffers. Now the git_buf ptr will always point to
a valid NUL-terminated string.
This change required jumping through a few hoops for git_buf_grow
and git_buf_free to distinguish between a actual allocated buffer
and the global initial value. Also, this moves the allocation
related functions to be next to each other near the top of buffer.c.
Diffstat (limited to 'src/commit.c')
0 files changed, 0 insertions, 0 deletions