aboutsummaryrefslogtreecommitdiffstats
path: root/dir.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-10-08 12:17:55 -0700
committerJunio C Hamano <gitster@pobox.com>2025-10-08 12:17:55 -0700
commit75f8dfabaa2f071ac2b527d225b0312d70f94e64 (patch)
tree0df6ed8cb28ecc9bf34c423f0d3aa87b791db8fb /dir.c
parentMerge branch 'mh/doc-credential-url-prefix' (diff)
parentci: enable Rust for breaking-changes jobs (diff)
downloadgit-75f8dfabaa2f071ac2b527d225b0312d70f94e64.tar.gz
git-75f8dfabaa2f071ac2b527d225b0312d70f94e64.zip
Merge branch 'ps/rust-balloon'
Dip our toes a bit to (optionally) use Rust implemented helper called from our C code. * ps/rust-balloon: ci: enable Rust for breaking-changes jobs ci: convert "pedantic" job into full build with breaking changes BreakingChanges: announce Rust becoming mandatory varint: reimplement as test balloon for Rust varint: use explicit width for integers help: report on whether or not Rust is enabled Makefile: introduce infrastructure to build internal Rust library Makefile: reorder sources after includes meson: add infrastructure to build internal Rust library
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/dir.c b/dir.c
index 71108ac79b..0a67a99cb3 100644
--- a/dir.c
+++ b/dir.c
@@ -3579,7 +3579,8 @@ static void write_one_dir(struct untracked_cache_dir *untracked,
struct stat_data stat_data;
struct strbuf *out = &wd->out;
unsigned char intbuf[16];
- unsigned int intlen, value;
+ unsigned int value;
+ uint8_t intlen;
int i = wd->index++;
/*
@@ -3632,7 +3633,7 @@ void write_untracked_extension(struct strbuf *out, struct untracked_cache *untra
struct ondisk_untracked_cache *ouc;
struct write_data wd;
unsigned char varbuf[16];
- int varint_len;
+ uint8_t varint_len;
const unsigned hashsz = the_hash_algo->rawsz;
CALLOC_ARRAY(ouc, 1);
@@ -3738,7 +3739,7 @@ static int read_one_dir(struct untracked_cache_dir **untracked_,
struct untracked_cache_dir ud, *untracked;
const unsigned char *data = rd->data, *end = rd->end;
const unsigned char *eos;
- unsigned int value;
+ uint64_t value;
int i;
memset(&ud, 0, sizeof(ud));
@@ -3830,7 +3831,8 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
struct read_data rd;
const unsigned char *next = data, *end = (const unsigned char *)data + sz;
const char *ident;
- int ident_len;
+ uint64_t ident_len;
+ uint64_t varint_len;
ssize_t len;
const char *exclude_per_dir;
const unsigned hashsz = the_hash_algo->rawsz;
@@ -3867,8 +3869,8 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
if (next >= end)
goto done2;
- len = decode_varint(&next);
- if (next > end || len == 0)
+ varint_len = decode_varint(&next);
+ if (next > end || varint_len == 0)
goto done2;
rd.valid = ewah_new();
@@ -3877,9 +3879,9 @@ struct untracked_cache *read_untracked_extension(const void *data, unsigned long
rd.data = next;
rd.end = end;
rd.index = 0;
- ALLOC_ARRAY(rd.ucd, len);
+ ALLOC_ARRAY(rd.ucd, varint_len);
- if (read_one_dir(&uc->root, &rd) || rd.index != len)
+ if (read_one_dir(&uc->root, &rd) || rd.index != varint_len)
goto done;
next = rd.data;