[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Libvir] [PATCH] Fix string handling in virDomain{Get, Set}SchedulerParameters
- From: Jim Meyering <jim meyering net>
- To: "Richard W.M. Jones" <rjones redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [Libvir] [PATCH] Fix string handling in virDomain{Get, Set}SchedulerParameters
- Date: Fri, 22 Jun 2007 12:19:20 +0200
"Richard W.M. Jones" <rjones redhat com> wrote:
> Let's try this updated patch.
Hi Rich,
It'd be nice to factor those "cap" and "weight" literal strings all
the way out, so each is defined in exactly one place.
Either with a file-scoped const declaration, e.g.,
static const char *cap_str = "cap";
or a cpp define:
#define CAP_STR "cap";
Then, there's no risk (however small) of changing
one of the literal strings without changing its mate.
> Index: src/xen_internal.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/xen_internal.c,v
> retrieving revision 1.79
> diff -u -p -r1.79 xen_internal.c
> --- src/xen_internal.c 6 Jun 2007 12:24:31 -0000 1.79
> +++ src/xen_internal.c 22 Jun 2007 10:01:29 -0000
> @@ -1071,8 +1071,6 @@ xenHypervisorGetSchedulerParameters(virD
...
> + strncpy (params[0].field, "weight", VIR_DOMAIN_SCHED_FIELD_LENGTH);
...
> + strncpy (params[1].field, "cap", VIR_DOMAIN_SCHED_FIELD_LENGTH);
...
> + if (STREQ (params[i].field, "weight") &&
...
> + } else if (STREQ (params[i].field, "cap") &&
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]