Fix ?: statements.
[git.git] / fsck-cache.c
index 6115514..ca24a1b 100644 (file)
@@ -390,7 +390,10 @@ static int fsck_head_link(void)
        char hex[40];
        unsigned char sha1[20];
        static char path[PATH_MAX], link[PATH_MAX];
-       const char *git_dir = gitenv(GIT_DIR_ENVIRONMENT) ? : DEFAULT_GIT_DIR_ENVIRONMENT;
+       const char *git_dir;
+
+       git_dir = gitenv(GIT_DIR_ENVIRONMENT);
+       if (!git_dir) git_dir = DEFAULT_GIT_DIR_ENVIRONMENT;
 
        snprintf(path, sizeof(path), "%s/HEAD", git_dir);
        if (readlink(path, link, sizeof(link)) < 0)
@@ -445,7 +448,7 @@ int main(int argc, char **argv)
                        continue;
                }
                if (*arg == '-')
-                       usage("git-fsck-cache [--tags] [[--unreachable] [--cache] [--standalone | --full] <head-sha1>*]");
+                       usage("git-fsck-cache [--tags] [--root] [[--unreachable] [--cache] [--standalone | --full] [--strict] <head-sha1>*]");
        }
 
        if (standalone && check_full)
@@ -456,13 +459,13 @@ int main(int argc, char **argv)
        fsck_head_link();
        fsck_object_dir(get_object_directory());
        if (check_full) {
-               int j;
+               struct alternate_object_database *alt;
                struct packed_git *p;
                prepare_alt_odb();
-               for (j = 0; alt_odb[j].base; j++) {
+               for (alt = alt_odb_list; alt; alt = alt->next) {
                        char namebuf[PATH_MAX];
-                       int namelen = alt_odb[j].name - alt_odb[j].base;
-                       memcpy(namebuf, alt_odb[j].base, namelen);
+                       int namelen = alt->name - alt->base;
+                       memcpy(namebuf, alt->base, namelen);
                        namebuf[namelen - 1] = 0;
                        fsck_object_dir(namebuf);
                }