summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2012-04-30 13:32:09 -0700
committerRussell Belfer <rb@github.com>2012-04-30 13:32:09 -0700
commit0dc8e95e1940017a9d6e8f5b13cf9a9ad644fc08 (patch)
tree49eed9a80b9e506953d18271bd03ae23558f29da /src/path.c
parent8b9ec201edf157f84735b8d220c10edafd9f4b5a (diff)
parent2de0652bb6d719eb937656153a920f20342bd5a4 (diff)
downloadlibgit2-0dc8e95e1940017a9d6e8f5b13cf9a9ad644fc08.tar.gz
Merge pull request #652 from nulltoken/topic/diff-callbacks
diff: provide more context to the consumer of the callbacks
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/path.c b/src/path.c
index a7cf4402f..f562b0b9e 100644
--- a/src/path.c
+++ b/src/path.c
@@ -221,8 +221,8 @@ int git_path_prettify_dir(git_buf *path_out, const char *path, const char *base)
int git_path_to_dir(git_buf *path)
{
if (path->asize > 0 &&
- path->size > 0 &&
- path->ptr[path->size - 1] != '/')
+ git_buf_len(path) > 0 &&
+ path->ptr[git_buf_len(path) - 1] != '/')
git_buf_putc(path, '/');
return git_buf_oom(path) ? -1 : 0;
@@ -327,12 +327,12 @@ int git_path_walk_up(
if (git__prefixcmp(path->ptr, ceiling) == 0)
stop = (ssize_t)strlen(ceiling);
else
- stop = path->size;
+ stop = git_buf_len(path);
}
- scan = path->size;
+ scan = git_buf_len(path);
iter.ptr = path->ptr;
- iter.size = path->size;
+ iter.size = git_buf_len(path);
iter.asize = path->asize;
while (scan >= stop) {
@@ -407,7 +407,7 @@ static bool _check_dir_contents(
bool (*predicate)(const char *))
{
bool result;
- size_t dir_size = dir->size;
+ size_t dir_size = git_buf_len(dir);
size_t sub_size = strlen(sub);
/* leave base valid even if we could not make space for subdir */
@@ -503,7 +503,7 @@ int git_path_direach(
if (git_path_to_dir(path) < 0)
return -1;
- wd_len = path->size;
+ wd_len = git_buf_len(path);
if ((dir = opendir(path->ptr)) == NULL) {
giterr_set(GITERR_OS, "Failed to open directory '%s'", path->ptr);