Re: git: 872c4402af13 - main - ddb: Don't throw away qualifier when pretty-printing unnamed pointers

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Wed, 03 Apr 2024 17:53:17 UTC
On 3 Apr 2024, at 17:18, Bojan Novković <bnovkov@FreeBSD.org> wrote:
> 
> The branch main has been updated by bnovkov:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=872c4402af1325ed156d7f5ee2252dd36b016b5c
> 
> commit 872c4402af1325ed156d7f5ee2252dd36b016b5c
> Author:     Bojan Novković <bnovkov@FreeBSD.org>
> AuthorDate: 2024-04-03 15:55:13 +0000
> Commit:     Bojan Novković <bnovkov@FreeBSD.org>
> CommitDate: 2024-04-03 16:17:54 +0000
> 
>    ddb: Don't throw away qualifier when pretty-printing unnamed pointers
> 
>    Reported by:    jrtc27
>    Fixes:  c21bc6f ("ddb: Add CTF-based pretty printing")
>    Approved by:    markj (mentor)
> ---
> sys/ddb/db_pprint.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sys/ddb/db_pprint.c b/sys/ddb/db_pprint.c
> index b4116372cf65..8e6759a03220 100644
> --- a/sys/ddb/db_pprint.c
> +++ b/sys/ddb/db_pprint.c
> @@ -276,7 +276,7 @@ db_pprint_ptr(db_addr_t addr, struct ctf_type_v3 *type, u_int depth)
> if (name != NULL)
> db_printf("(%s%s *) 0x%lx", qual, name, (long)val);
> else
> - db_printf("0x%lx", (long)val);
> + db_printf("(%s *) 0x%lx", qual, (long)val);

At this point, why not just:

db_printf("(%s%s *) 0x%lx", qual, name != NULL ? name : "", (long)val);

Jess