Re: [PATCH 01/14] xen: Constify the second parameter of rangeset_new()
Hi Jan, On 06/04/2021 08:57, Jan Beulich wrote: On 05.04.2021 17:57, Julien Grall wrote: From: Julien Grall The string 'name' will never get modified by the function, so mark it as const. Signed-off-by: Julien Grall Reviewed-by: Jan Beulich Thanks! --- a/xen/common/rangeset.c +++ b/xen/common/rangeset.c @@ -421,7 +421,7 @@ bool_t rangeset_is_empty( } struct rangeset *rangeset_new( -struct domain *d, char *name, unsigned int flags) +struct domain *d, const char *name, unsigned int flags) { struct rangeset *r; Remotely along these lines the function also has no need anymore to use snprintf() - safe_strcpy() very well fits both purposes. But quite likely for another patch. I saw you already sent the patch for that. So I am assuming there is no action for me here. Cheers, -- Julien Grall
Re: [PATCH 01/14] xen: Constify the second parameter of rangeset_new()
On 05.04.2021 17:57, Julien Grall wrote: > From: Julien Grall > > The string 'name' will never get modified by the function, so mark it > as const. > > Signed-off-by: Julien Grall Reviewed-by: Jan Beulich > --- a/xen/common/rangeset.c > +++ b/xen/common/rangeset.c > @@ -421,7 +421,7 @@ bool_t rangeset_is_empty( > } > > struct rangeset *rangeset_new( > -struct domain *d, char *name, unsigned int flags) > +struct domain *d, const char *name, unsigned int flags) > { > struct rangeset *r; Remotely along these lines the function also has no need anymore to use snprintf() - safe_strcpy() very well fits both purposes. But quite likely for another patch. Jan
[PATCH 01/14] xen: Constify the second parameter of rangeset_new()
From: Julien Grall The string 'name' will never get modified by the function, so mark it as const. Signed-off-by: Julien Grall --- xen/common/rangeset.c | 2 +- xen/include/xen/rangeset.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c index 4ebba30ba303..d997d7bce9e2 100644 --- a/xen/common/rangeset.c +++ b/xen/common/rangeset.c @@ -421,7 +421,7 @@ bool_t rangeset_is_empty( } struct rangeset *rangeset_new( -struct domain *d, char *name, unsigned int flags) +struct domain *d, const char *name, unsigned int flags) { struct rangeset *r; diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h index 5f62a9797170..135f33f6066f 100644 --- a/xen/include/xen/rangeset.h +++ b/xen/include/xen/rangeset.h @@ -36,7 +36,7 @@ void rangeset_domain_destroy( * rangeset_destroy(r). */ struct rangeset *rangeset_new( -struct domain *d, char *name, unsigned int flags); +struct domain *d, const char *name, unsigned int flags); void rangeset_destroy( struct rangeset *r); -- 2.17.1