1
0
Fork 0
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:
Nobuyoshi Nakada 2021-04-02 09:55:15 +09:00
parent 79af8ce6d7
commit 43e0677c6d
Notes: git 2021-04-02 14:17:54 +09:00

3
file.c
View file

@ -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;
}
}