mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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 ```
This commit is contained in:
parent
79af8ce6d7
commit
43e0677c6d
Notes:
git
2021-04-02 14:17:54 +09:00
1 changed files with 1 additions and 2 deletions
3
file.c
3
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue