Thread (15 messages) flat view 15 messages, 3 authors, 2016-06-15

Re: [PATCH 2/5] safe_create_leading_directories(): reduce scope of local variable

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:59:30

Michael Haggerty wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Michael Haggerty <redacted>
---
 sha1_file.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sha1_file.c b/sha1_file.c
index c9245a6..cc9957e 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -108,9 +108,10 @@ int mkdir_in_gitdir(const char *path)
 int safe_create_leading_directories(char *path)
 {
 	char *pos = path + offset_1st_component(path);
-	struct stat st;
 
 	while (pos) {
+		struct stat st;
Is this to make it easier to reason about whether 'st' has been
properly initialized at any given moment, or is there a more subtle
reason?

Curious,
Jonathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help