summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-04-02 09:55:15 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-04-02 14:17:33 +0900
commit43e0677c6de891c184da4ec66a03005d0824d5d0 (patch)
tree33c782b3fe856376ca20a15b780cb28ce4dc01aa /file.c
parent79af8ce6d7f46e7e79180dbd6bef6681c1329bd9 (diff)
Fill the ring-buffer with the fallback value
Fill with the pointer to the root position, instead of zero and comparing later. Also suppress a false warning by Visual C++. ``` file.c(4759): warning C4090: 'function': different 'const' qualifiers ```
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4348
Diffstat (limited to 'file.c')
-rw-r--r--file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/file.c b/file.c
index e8e4b1d541..6e6dfbca17 100644
--- a/file.c
+++ b/file.c
@@ -4756,7 +4756,7 @@ rb_file_dirname_n(VALUE fname, int n)
break;
default:
seps = ALLOCV_N(const char *, sepsv, n);
- MEMZERO(seps, const char *, n);
+ for (i = 0; i < n; ++i) seps[i] = root;
i = 0;
for (p = root; p < end; ) {
if (isdirsep(*p)) {
@@ -4772,7 +4772,6 @@ rb_file_dirname_n(VALUE fname, int n)
}
p = seps[i];
ALLOCV_END(sepsv);
- if (!p) p = root;
break;
}
}