diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-15 13:28:08 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-06-15 13:43:48 +0200 |
commit | 25bd0aaf20463fd9d00d882d39cb1cfec4aa6917 (patch) | |
tree | 14b772556825babc21b153d7fb93dce1e2cabea8 | |
parent | 2665fefa0f3af60c04b747e2f06c0d4ca6ea75f7 (diff) | |
download | libgit2-25bd0aaf20463fd9d00d882d39cb1cfec4aa6917.tar.gz |
path: remove unnecessary readdir_r usagecmn/readdir
Arguably all uses of readdir_r are unnecessary, but in this case
especially so, as the directory handle only exists within this function,
so we don't race with anybody.
-rw-r--r-- | src/path.c | 7 | ||||
-rw-r--r-- | src/path.h | 2 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/path.c b/src/path.c index 0ee3efad7..aca85f992 100644 --- a/src/path.c +++ b/src/path.c @@ -889,7 +889,7 @@ void git_path_iconv_clear(git_path_iconv_t *ic) } } -int git_path_iconv(git_path_iconv_t *ic, char **in, size_t *inlen) +int git_path_iconv(git_path_iconv_t *ic, const char **in, size_t *inlen) { char *nfd = *in, *nfc; size_t nfdlen = *inlen, nfclen, wantlen = nfdlen, alloclen, rv; @@ -1018,8 +1018,7 @@ int git_path_direach( int error = 0; ssize_t wd_len; DIR *dir; - path_dirent_data de_data; - struct dirent *de, *de_buf = (struct dirent *)&de_data; + struct dirent *de; #ifdef GIT_USE_ICONV git_path_iconv_t ic = GIT_PATH_ICONV_INIT; @@ -1045,7 +1044,7 @@ int git_path_direach( (void)git_path_iconv_init_precompose(&ic); #endif - while (p_readdir_r(dir, de_buf, &de) == 0 && de != NULL) { + while ((de = readdir(dir)) != NULL) { char *de_path = de->d_name; size_t de_len = strlen(de_path); diff --git a/src/path.h b/src/path.h index 14237cb46..5927a5381 100644 --- a/src/path.h +++ b/src/path.h @@ -407,7 +407,7 @@ extern void git_path_iconv_clear(git_path_iconv_t *ic); * pointer internal iconv buffer if rewrite happened. The `in` pointer * will be left unchanged if no rewrite was needed. */ -extern int git_path_iconv(git_path_iconv_t *ic, char **in, size_t *inlen); +extern int git_path_iconv(git_path_iconv_t *ic, const char **in, size_t *inlen); #endif /* GIT_USE_ICONV */ |