mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
Convert 'int i' to 'size_t i' in src/cpu/ files
Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
9dc913172f
commit
c220aa917f
@ -50,8 +50,8 @@ static struct cpuArchDriver *drivers[] = {
|
||||
static struct cpuArchDriver *
|
||||
cpuGetSubDriver(virArch arch)
|
||||
{
|
||||
unsigned int i;
|
||||
unsigned int j;
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
if (arch == VIR_ARCH_NONE) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -140,9 +140,9 @@ cpuDecode(virCPUDefPtr cpu,
|
||||
VIR_DEBUG("cpu=%p, data=%p, nmodels=%u, preferred=%s",
|
||||
cpu, data, nmodels, NULLSTR(preferred));
|
||||
if (models) {
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
for (i = 0; i < nmodels; i++)
|
||||
VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
|
||||
VIR_DEBUG("models[%zu]=%s", i, NULLSTR(models[i]));
|
||||
}
|
||||
|
||||
if (models == NULL && nmodels != 0) {
|
||||
@ -284,16 +284,16 @@ cpuBaselineXML(const char **xmlCPUs,
|
||||
virCPUDefPtr *cpus = NULL;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
char *cpustr;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
|
||||
if (xmlCPUs) {
|
||||
for (i = 0; i < ncpus; i++)
|
||||
VIR_DEBUG("xmlCPUs[%u]=%s", i, NULLSTR(xmlCPUs[i]));
|
||||
VIR_DEBUG("xmlCPUs[%zu]=%s", i, NULLSTR(xmlCPUs[i]));
|
||||
}
|
||||
if (models) {
|
||||
for (i = 0; i < nmodels; i++)
|
||||
VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
|
||||
VIR_DEBUG("models[%zu]=%s", i, NULLSTR(models[i]));
|
||||
}
|
||||
|
||||
if (xmlCPUs == NULL && ncpus != 0) {
|
||||
@ -354,16 +354,16 @@ cpuBaseline(virCPUDefPtr *cpus,
|
||||
unsigned int nmodels)
|
||||
{
|
||||
struct cpuArchDriver *driver;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
VIR_DEBUG("ncpus=%u, nmodels=%u", ncpus, nmodels);
|
||||
if (cpus) {
|
||||
for (i = 0; i < ncpus; i++)
|
||||
VIR_DEBUG("cpus[%u]=%p", i, cpus[i]);
|
||||
VIR_DEBUG("cpus[%zu]=%p", i, cpus[i]);
|
||||
}
|
||||
if (models) {
|
||||
for (i = 0; i < nmodels; i++)
|
||||
VIR_DEBUG("models[%u]=%s", i, NULLSTR(models[i]));
|
||||
VIR_DEBUG("models[%zu]=%s", i, NULLSTR(models[i]));
|
||||
}
|
||||
|
||||
if (cpus == NULL && ncpus != 0) {
|
||||
@ -446,7 +446,7 @@ cpuModelIsAllowed(const char *model,
|
||||
const char **models,
|
||||
unsigned int nmodels)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (!models || !nmodels)
|
||||
return true;
|
||||
|
@ -37,7 +37,7 @@ static virHashTablePtr
|
||||
genericHashFeatures(virCPUDefPtr cpu)
|
||||
{
|
||||
virHashTablePtr hash;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if ((hash = virHashCreate(cpu->nfeatures, NULL)) == NULL)
|
||||
return NULL;
|
||||
@ -61,7 +61,7 @@ genericCompare(virCPUDefPtr host,
|
||||
{
|
||||
virHashTablePtr hash;
|
||||
virCPUCompareResult ret = VIR_CPU_COMPARE_ERROR;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
unsigned int reqfeatures;
|
||||
|
||||
if (((cpu->arch != VIR_ARCH_NONE) &&
|
||||
@ -119,7 +119,7 @@ genericBaseline(virCPUDefPtr *cpus,
|
||||
virCPUFeatureDefPtr features = NULL;
|
||||
unsigned int nfeatures;
|
||||
unsigned int count;
|
||||
unsigned int i, j;
|
||||
size_t i, j;
|
||||
|
||||
if (!cpuModelIsAllowed(cpus[0]->model, models, nmodels)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
|
@ -383,7 +383,7 @@ ppcBaseline(virCPUDefPtr *cpus,
|
||||
const struct ppc_model *model;
|
||||
const struct ppc_vendor *vendor = NULL;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (!(map = ppcLoadMap()))
|
||||
goto error;
|
||||
|
@ -185,7 +185,7 @@ x86DataCpuid(const union cpuData *data,
|
||||
{
|
||||
struct cpuX86cpuid *cpuids;
|
||||
int len;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (function < CPUX86_EXTENDED) {
|
||||
cpuids = data->x86.basic;
|
||||
@ -221,7 +221,7 @@ static union cpuData *
|
||||
x86DataCopy(const union cpuData *data)
|
||||
{
|
||||
union cpuData *copy = NULL;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if (VIR_ALLOC(copy) < 0
|
||||
|| VIR_ALLOC_N(copy->x86.basic, data->x86.basic_len) < 0
|
||||
@ -303,7 +303,7 @@ static int
|
||||
x86DataAdd(union cpuData *data1,
|
||||
const union cpuData *data2)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (x86DataExpand(data1,
|
||||
data2->x86.basic_len - data1->x86.basic_len,
|
||||
@ -328,7 +328,7 @@ static void
|
||||
x86DataSubtract(union cpuData *data1,
|
||||
const union cpuData *data2)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
unsigned int len;
|
||||
|
||||
len = MIN(data1->x86.basic_len, data2->x86.basic_len);
|
||||
@ -649,7 +649,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
|
||||
xmlNodePtr ctxt_node = ctxt->node;
|
||||
struct x86_feature *feature;
|
||||
int ret = 0;
|
||||
int i;
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
if (!(feature = x86FeatureNew()))
|
||||
@ -688,7 +688,7 @@ x86FeatureLoad(xmlXPathContextPtr ctxt,
|
||||
if (ret_fun < 0 || ret_eax == -2 || ret_ebx == -2
|
||||
|| ret_ecx == -2 || ret_edx == -2) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Invalid cpuid[%d] in %s feature"), i, feature->name);
|
||||
_("Invalid cpuid[%zu] in %s feature"), i, feature->name);
|
||||
goto ignore;
|
||||
}
|
||||
|
||||
@ -795,7 +795,7 @@ x86ModelFromCPU(const virCPUDefPtr cpu,
|
||||
int policy)
|
||||
{
|
||||
struct x86_model *model = NULL;
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
if (policy == VIR_CPU_FEATURE_REQUIRE) {
|
||||
if ((model = x86ModelFind(map, cpu->model)) == NULL) {
|
||||
@ -843,7 +843,7 @@ x86ModelSubtractCPU(struct x86_model *model,
|
||||
const struct x86_map *map)
|
||||
{
|
||||
const struct x86_model *cpu_model;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (!(cpu_model = x86ModelFind(map, cpu->model))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -925,7 +925,7 @@ x86ModelLoad(xmlXPathContextPtr ctxt,
|
||||
struct x86_model *model;
|
||||
char *vendor = NULL;
|
||||
int ret = 0;
|
||||
int i;
|
||||
size_t i;
|
||||
int n;
|
||||
|
||||
if (!(model = x86ModelNew()))
|
||||
@ -1142,7 +1142,7 @@ x86Compute(virCPUDefPtr host,
|
||||
struct x86_model *guest_model = NULL;
|
||||
virCPUCompareResult ret;
|
||||
enum compare_result result;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (cpu->arch != VIR_ARCH_NONE) {
|
||||
bool found = false;
|
||||
@ -1294,7 +1294,7 @@ x86Decode(virCPUDefPtr cpu,
|
||||
const struct x86_model *candidate;
|
||||
virCPUDefPtr cpuCandidate;
|
||||
virCPUDefPtr cpuModel = NULL;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
if (data == NULL || (map = x86LoadMap()) == NULL)
|
||||
return -1;
|
||||
@ -1595,7 +1595,7 @@ x86Baseline(virCPUDefPtr *cpus,
|
||||
struct x86_map *map = NULL;
|
||||
struct x86_model *base_model = NULL;
|
||||
virCPUDefPtr cpu = NULL;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
const struct x86_vendor *vendor = NULL;
|
||||
struct x86_model *model = NULL;
|
||||
bool outputVendor = true;
|
||||
@ -1698,7 +1698,7 @@ x86UpdateCustom(virCPUDefPtr guest,
|
||||
const virCPUDefPtr host)
|
||||
{
|
||||
int ret = -1;
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
struct x86_map *map;
|
||||
struct x86_model *host_model = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user