[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RESEND PATCH 1/2] tools/libxl: Mark pointer args of many functions constant


  • To: Elliott Mitchell <ehem+xen@xxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 27 Apr 2021 15:53:47 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 27 Apr 2021 14:54:06 +0000
  • Ironport-hdrordr: A9a23:ifoPCqgK0Fmgv1wWzjBkTCaJMXBQXkUji2hD6mlwRA09T+Wzva mV8sgz/xnylToXRTUMmcqYPrOBXHPb8vdOkO0sFJ2lWxTrv3btEZF64eLZsljdMgD36+I178 pdWodkDtmYNzRHpOb8pDK1CtMxhOSAmZrY4tv261dIYUVUZ7p77wF/YzzrcHFeYAVdH5I2GN 69y6N8xwaIQngcYsSlCnRtZYGqzLf2vanrbhIcCxks5BPmt0LK1JfAHwWFxRBbajtTwN4ZgA 74ujbk7aauuezT8H7h/lLUhq44pOfc
  • Ironport-sdr: DkviUs63HqyqHYYrNN0GLeM6LxJMLtcFF5kch6awNEytKwxD1tW3rrHCCDoFG9etmHDgmNKHPB 5yGatkp2srVuVyq+IWQL7Svtd0Sda1K6fkosY/gzt2y0oQSLgO7N/p8wuAKZV035StNROYAXFy 9eC7CQTr6BLLyL8PqchWPhrrjLT3GEur8yh1d4tdWX576lsZvsJJOMkcS+GOwv5btHRsmwMl0U rTRqvRZmWoP0mUYp3hWYPk6Lm5uA44jryIzULsikcFvlwxDioXRj3oBesqC/7bUQuIPf0IaNys kto=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxx>
> ---
> 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



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.