Rename p2 in load_pgen to zone_list

This commit is contained in:
Marcus Weseloh 2021-03-14 20:58:03 +01:00
parent a044835cf5
commit b5d80a1248

View file

@ -1368,7 +1368,8 @@ static int load_pmod(SFData *sf, int size)
* ------------------------------------------------------------------- */
static int load_pgen(SFData *sf, int size)
{
fluid_list_t *p, *p2, *dup, **hz = NULL;
fluid_list_t *p, *dup, **hz = NULL;
fluid_list_t *zone_list;
fluid_list_t *gen_list;
SFZone *z;
SFGen *g;
@ -1383,18 +1384,18 @@ static int load_pgen(SFData *sf, int size)
/* traverse through all presets */
gzone = FALSE;
discarded = FALSE;
p2 = ((SFPreset *)(p->data))->zone;
zone_list = ((SFPreset *)(p->data))->zone;
if(p2)
if(zone_list)
{
hz = &p2;
hz = &zone_list;
}
while(p2)
while(zone_list)
{
/* traverse preset's zones */
level = 0;
z = (SFZone *)(p2->data);
z = (SFZone *)(zone_list->data);
gen_list = z->gen;
while(gen_list)
@ -1445,7 +1446,7 @@ static int load_pgen(SFData *sf, int size)
/* inst is last gen */
level = 3;
READW(sf, genval.uword);
((SFZone *)(p2->data))->instsamp = FLUID_INT_TO_POINTER(genval.uword + 1);
((SFZone *)(zone_list->data))->instsamp = FLUID_INT_TO_POINTER(genval.uword + 1);
break; /* break out of generator loop */
}
else
@ -1518,12 +1519,12 @@ static int load_pgen(SFData *sf, int size)
gzone = TRUE;
/* if global zone is not 1st zone, relocate */
if(*hz != p2)
if(*hz != zone_list)
{
void *save = p2->data;
void *save = zone_list->data;
FLUID_LOG(FLUID_WARN, "Preset '%s': Global zone is not first zone",
((SFPreset *)(p->data))->name);
SLADVREM(*hz, p2);
SLADVREM(*hz, zone_list);
*hz = fluid_list_prepend(*hz, save);
continue;
}
@ -1533,8 +1534,8 @@ static int load_pgen(SFData *sf, int size)
/* previous global zone exists, discard */
FLUID_LOG(FLUID_WARN, "Preset '%s': Discarding invalid global zone",
((SFPreset *)(p->data))->name);
*hz = fluid_list_remove(*hz, p2->data);
delete_zone((SFZone *)fluid_list_get(p2));
*hz = fluid_list_remove(*hz, zone_list->data);
delete_zone((SFZone *)fluid_list_get(zone_list));
}
}
@ -1553,7 +1554,7 @@ static int load_pgen(SFData *sf, int size)
SLADVREM(z->gen, gen_list);
}
p2 = fluid_list_next(p2); /* next zone */
zone_list = fluid_list_next(zone_list); /* next zone */
}
if(discarded)