mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 12:14:16 +00:00
tree: avoid advancing over the filename multiple times
We've already looked at the filename with `memchr()` and then used `strlen()` to allocate the entry. We already know how much we have to advance to get to the object id, so add the filename length instead of looking at each byte again.
This commit is contained in:
parent
e0ab1ca028
commit
7132150ddf
@ -414,10 +414,8 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
|||||||
entry->attr = attr;
|
entry->attr = attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (buffer < buffer_end && *buffer != 0)
|
/* Advance to the ID just after the path */
|
||||||
buffer++;
|
buffer += entry->filename_len + 1;
|
||||||
|
|
||||||
buffer++;
|
|
||||||
|
|
||||||
git_oid_fromraw(&entry->oid, (const unsigned char *)buffer);
|
git_oid_fromraw(&entry->oid, (const unsigned char *)buffer);
|
||||||
buffer += GIT_OID_RAWSZ;
|
buffer += GIT_OID_RAWSZ;
|
||||||
|
Loading…
Reference in New Issue
Block a user