]> git.ipfire.org Git - thirdparty/git.git/commit - dir.c
untracked-cache: simplify parsing by dropping "len"
authorJeff King <peff@peff.net>
Thu, 18 Apr 2019 21:18:35 +0000 (17:18 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Apr 2019 05:33:21 +0000 (14:33 +0900)
commit08bf354de71a806bad319ec236740ac698b58a5b
tree8056fc31cd23e69c206b54f2bd2b91ad16f1f047
parentb511d6d569ce8baee888700ebd12f82d991a5250
untracked-cache: simplify parsing by dropping "len"

The code which parses untracked-cache extensions from disk keeps a "len"
variable, which is the size of the string we are parsing. But since we
now have an "end of string" variable, we can just use that to get the
length when we need it. This eliminates the need to keep "len" up to
date (and removes the possibility of any errors where "len" and "eos"
get out of sync).

As a bonus, it means we are not storing a string length in an "int",
which is a potential source of overflows (though in this case it seems
fairly unlikely for that to cause any memory problems).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
dir.c