Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Feb 2022 09:34:29 -0800
From:      John Baldwin <jhb@FreeBSD.org>
To:        Wolfram Schneider <wosch@FreeBSD.org>, src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   Re: git: 792df7ced212 - main - improve casting for pointer diffs
Message-ID:  <34d1b854-1bed-b744-e985-f72349246da7@FreeBSD.org>
In-Reply-To: <202202011726.211HQhp4013714@gitrepo.freebsd.org>
References:  <202202011726.211HQhp4013714@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2/1/22 9:26 AM, Wolfram Schneider wrote:
> The branch main has been updated by wosch:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=792df7ced212b1bb3993e8538ed511b36b146f95
> 
> commit 792df7ced212b1bb3993e8538ed511b36b146f95
> Author:     Wolfram Schneider <wosch@FreeBSD.org>
> AuthorDate: 2022-02-01 17:26:20 +0000
> Commit:     Wolfram Schneider <wosch@FreeBSD.org>
> CommitDate: 2022-02-01 17:26:20 +0000
> 
>      improve casting for pointer diffs
> ---
>   usr.bin/locate/locate/fastfind.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/usr.bin/locate/locate/fastfind.c b/usr.bin/locate/locate/fastfind.c
> index d67c6c776f67..0dbec4ea15d3 100644
> --- a/usr.bin/locate/locate/fastfind.c
> +++ b/usr.bin/locate/locate/fastfind.c
> @@ -296,7 +296,7 @@ fastfind
>   			}
>   
>   			if (p - path >= LOCATE_PATH_MAX)
> -				errx(1, "corrupted database: %s %d", database, (int)(p - path));
> +				errx(1, "corrupted database: %s %zu", database, (size_t)(p - path));

p - path returns a ptrdiff_t which can be printed directly via the 't' modifier:

errx(1, "corrupted database: %s %td", database, p - path);

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?34d1b854-1bed-b744-e985-f72349246da7>