diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-04-29 21:46:33 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-04-30 07:12:37 +0200 |
commit | fa6420f73e8a621cc04e95820b625097b5c2fbf2 (patch) | |
tree | b5107d76b205dfb9b475606bb284da05b01e2a79 /src/path.c | |
parent | 1d2dd864add4835c49744a566c226a1c7da04e99 (diff) | |
download | libgit2-fa6420f73e8a621cc04e95820b625097b5c2fbf2.tar.gz |
buf: deploy git_buf_len()
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 14 |
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); |