diff options
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/sha1_name.c b/sha1_name.c index ddabb045a2..c5a05faeb6 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -12,21 +12,15 @@ static int find_short_object_filename(int len, const char *name, unsigned char * char hex[40]; int found = 0; static struct alternate_object_database *fakeent; - static const char *last_objdir; - const char *objdir = get_object_directory(); - if (!last_objdir || strcmp(last_objdir, objdir)) { + if (!fakeent) { + const char *objdir = get_object_directory(); int objdir_len = strlen(objdir); int entlen = objdir_len + 43; - if (fakeent) - free(fakeent); fakeent = xmalloc(sizeof(*fakeent) + entlen); memcpy(fakeent->base, objdir, objdir_len); fakeent->name = fakeent->base + objdir_len + 1; fakeent->name[-1] = '/'; - if (last_objdir) - free((char *) last_objdir); - last_objdir = strdup(objdir); } fakeent->next = alt_odb_list; |