for (i = 0; i < 20; i++) {
static char hex[] = "0123456789abcdef";
unsigned int val = sha1[i];
- char *pos = pathbuf + i*2 + (i > 0);
- *pos++ = hex[val >> 4];
- *pos = hex[val & 0xf];
+ *pathbuf++ = hex[val >> 4];
+ *pathbuf++ = hex[val & 0xf];
+ if (!i)
+ *pathbuf++ = '/';
}
+ *pathbuf = '\0';
}
const char *sha1_file_name(const unsigned char *sha1)
die("insanely long object directory %s", objdir);
memcpy(buf, objdir, len);
buf[len] = '/';
- buf[len+3] = '/';
- buf[len+42] = '\0';
fill_sha1_path(buf + len + 1, sha1);
return buf;
}
ent->name = ent->scratch + dirlen + 1;
ent->scratch[dirlen] = '/';
- ent->scratch[dirlen + 3] = '/';
- ent->scratch[entlen-1] = 0;
return ent;
}