[前][次][番号順一覧][スレッド一覧]

ruby-changes:65731

From: Nobuyoshi <ko1@a...>
Date: Fri, 2 Apr 2021 14:17:50 +0900 (JST)
Subject: [ruby-changes:65731] 43e0677c6d (master): Fill the ring-buffer with the fallback value

https://git.ruby-lang.org/ruby.git/commit/?id=43e0677c6d

From 43e0677c6de891c184da4ec66a03005d0824d5d0 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Fri, 2 Apr 2021 09:55:15 +0900
Subject: 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
```
---
 file.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/file.c b/file.c
index e8e4b1d..6e6dfbc 100644
--- a/file.c
+++ b/file.c
@@ -4756,7 +4756,7 @@ rb_file_dirname_n(VALUE fname, int n) https://github.com/ruby/ruby/blob/trunk/file.c#L4756
 	    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) https://github.com/ruby/ruby/blob/trunk/file.c#L4772
 	    }
 	    p = seps[i];
 	    ALLOCV_END(sepsv);
-	    if (!p) p = root;
 	    break;
 	}
     }
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]