"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: send_tree_entries: simplify len computing
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Mon, 13 Feb 2023 15:21:14 +0100

Download raw body.

Thread
On Mon, Feb 13, 2023 at 02:39:12PM +0100, Omar Polo wrote:
> when fixing the len computing in 6c77e03376 I forgot to note that
> since send_tree_entries_batch converts the struct
> got_parsed_tree_entry to got_imsg_tree_entry, so instead of summing
> all the fields we can use the size of the latter.

Indeed, this is nicer. ok stsp

> diff /home/op/w/gotd
> commit - 7b771fb638e62245e029bcceaa32c0dce315b23c
> path + /home/op/w/gotd
> blob - 8954b4c42e443bbd5ba01b707de2fd26e6410d19
> file + lib/privsep.c
> --- lib/privsep.c
> +++ lib/privsep.c
> @@ -1451,8 +1451,7 @@ send_tree_entries(struct imsgbuf *ibuf, struct got_par
>  	i = 0;
>  	for (j = 0; j < nentries; j++) {
>  		struct got_parsed_tree_entry *pte = &entries[j];
> -		size_t len = SHA1_DIGEST_LENGTH + sizeof(pte->mode) +
> -		    sizeof(pte->namelen) + pte->namelen;
> +		size_t len = sizeof(struct got_imsg_tree_entry) + pte->namelen;
>  
>  		if (j > 0 &&
>  		    entries_len + len > MAX_IMSGSIZE - IMSG_HEADER_SIZE) {
> 
>