|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 02/14] xen/sched: Constify name and opt_name in struct scheduler
On 05.04.2021 17:57, Julien Grall wrote:
> From: Julien Grall <jgrall@xxxxxxxxxx>
>
> Both name and opt_name are pointing to literal string. So mark both of
> the fields as const.
>
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
albeit ...
> --- a/xen/common/sched/private.h
> +++ b/xen/common/sched/private.h
> @@ -272,8 +272,8 @@ static inline spinlock_t *pcpu_schedule_trylock(unsigned
> int cpu)
> }
>
> struct scheduler {
> - char *name; /* full name for this scheduler */
> - char *opt_name; /* option name for this scheduler */
> + const char *name; /* full name for this scheduler */
> + const char *opt_name; /* option name for this scheduler */
... I'd like to suggest considering at least the latter to become
an array instead of a pointer - there's little point wasting 8
bytes of storage for the pointer when the strings pointed to are
all at most 9 bytes long (right now; I don't expect much longer
ones to appear).
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |