OSDN Git Service

safe_create_leading_directories(): reduce scope of local variable
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 6 Jan 2014 13:45:20 +0000 (14:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 6 Jan 2014 17:34:19 +0000 (09:34 -0800)
This makes it more obvious that values of "st" don't persist across
loop iterations.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c

index 56b51b0..e52a003 100644 (file)
@@ -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;
+
                pos = strchr(pos, '/');
                if (!pos)
                        break;