All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Elliott Mitchell <ehem+xen@m5p.com>
Cc: <xen-devel@lists.xenproject.org>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>
Subject: Re: [RESEND PATCH 1/2] tools/libxl: Mark pointer args of many functions constant
Date: Tue, 27 Apr 2021 15:53:47 +0100	[thread overview]
Message-ID: <YIgle+MaWg8fhtQy@perard> (raw)
In-Reply-To: <2e18b114fc91028459b2d6cbfd0f1204501dfde9.1613496229.git.ehem+xen@m5p.com>

On Fri, Dec 18, 2020 at 01:37:44PM -0800, Elliott Mitchell wrote:
> Anything *_is_empty(), *_is_default(), or *_gen_json() is going to be
> examining the pointed to thing, not modifying it.  This potentially
> results in higher-performance output.  This also allows spreading
> constants further, allowing more checking and security.
> 
> Signed-off-by: Elliott Mitchell <ehem+xen@m5p.com>
> ---
> diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
> index 028bc013d9..e3df881d08 100644
> --- a/tools/libs/light/libxl_internal.h
> +++ b/tools/libs/light/libxl_internal.h
[..]
> -static inline bool libxl__string_is_default(char **s)
> +static inline bool libxl__string_is_default(char *const *s)

That looks weird to not also have "char" been "const", but I've tried to
change that and the compiler wasn't cooperative so I guess that's fine.


> diff --git a/tools/libs/light/libxl_nocpuid.c b/tools/libs/light/libxl_nocpuid.c
> index f47336565b..73580351b3 100644
> --- a/tools/libs/light/libxl_nocpuid.c
> +++ b/tools/libs/light/libxl_nocpuid.c
> @@ -40,7 +40,7 @@ void libxl__cpuid_legacy(libxl_ctx *ctx, uint32_t domid, bool restore,
>  }
>  
>  yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
> -                                libxl_cpuid_policy_list *pcpuid)
> +                                const libxl_cpuid_policy_list *pcpuid)

That change is missing in libxl_cpuid.c.


The rest looks fine, so once libxl_cpuid.c is fix, you can have my Reviewed-by.

Thanks,

-- 
Anthony PERARD


  reply	other threads:[~2021-04-27 14:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 17:23 [RESEND PATCH 0/2] Adding const to many libxl/xl functions Elliott Mitchell
2020-12-18 21:32 ` [RESEND PATCH 2/2] tools/xl: Mark libxl_domain_config * arg of printf_info_*() const Elliott Mitchell
2021-04-27 14:54   ` Anthony PERARD
2020-12-18 21:37 ` [RESEND PATCH 1/2] tools/libxl: Mark pointer args of many functions constant Elliott Mitchell
2021-04-27 14:53   ` Anthony PERARD [this message]
2021-04-28 17:12   ` [SUSPECTED SPAM][RESEND " Anthony PERARD
2021-04-28 17:29     ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YIgle+MaWg8fhtQy@perard \
    --to=anthony.perard@citrix.com \
    --cc=ehem+xen@m5p.com \
    --cc=iwj@xenproject.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.