mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-11-13 00:04:10 +00:00
delete_*() refactorings in defsfont
This commit is contained in:
parent
60121af287
commit
1b2a098c7c
2 changed files with 14 additions and 22 deletions
|
@ -496,8 +496,7 @@ int delete_fluid_defsfont(fluid_defsfont_t* sfont)
|
|||
fluid_defpreset_t* preset;
|
||||
fluid_sample_t* sample;
|
||||
|
||||
if(sfont == NULL)
|
||||
return FLUID_OK;
|
||||
fluid_return_val_if_fail(sfont != NULL, FLUID_OK);
|
||||
|
||||
/* Check that no samples are currently used */
|
||||
for (list = sfont->sample; list; list = fluid_list_next(list)) {
|
||||
|
@ -620,8 +619,7 @@ int fluid_defsfont_load(fluid_defsfont_t* sfont, const char* file)
|
|||
|
||||
err_exit:
|
||||
sfont_close (sfdata);
|
||||
if (preset != NULL)
|
||||
delete_fluid_defpreset(preset);
|
||||
delete_fluid_defpreset(preset);
|
||||
return FLUID_FAILED;
|
||||
}
|
||||
|
||||
|
@ -746,14 +744,12 @@ new_fluid_defpreset(fluid_defsfont_t* sfont)
|
|||
/*
|
||||
* delete_fluid_defpreset
|
||||
*/
|
||||
int
|
||||
void
|
||||
delete_fluid_defpreset(fluid_defpreset_t* preset)
|
||||
{
|
||||
int err = FLUID_OK;
|
||||
fluid_preset_zone_t* zone;
|
||||
|
||||
if(preset == NULL)
|
||||
return err;
|
||||
fluid_return_if_fail(preset != NULL);
|
||||
|
||||
delete_fluid_preset_zone(preset->global_zone);
|
||||
preset->global_zone = NULL;
|
||||
|
@ -765,7 +761,6 @@ delete_fluid_defpreset(fluid_defpreset_t* preset)
|
|||
zone = preset->zone;
|
||||
}
|
||||
FLUID_FREE(preset);
|
||||
return err;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -1168,8 +1163,7 @@ delete_fluid_preset_zone(fluid_preset_zone_t* zone)
|
|||
{
|
||||
fluid_mod_t *mod, *tmp;
|
||||
|
||||
if(zone == NULL)
|
||||
return;
|
||||
fluid_return_if_fail(zone != NULL);
|
||||
|
||||
mod = zone->mod;
|
||||
while (mod) /* delete the modulators */
|
||||
|
@ -1179,8 +1173,8 @@ delete_fluid_preset_zone(fluid_preset_zone_t* zone)
|
|||
fluid_mod_delete (tmp);
|
||||
}
|
||||
|
||||
if (zone->name) FLUID_FREE (zone->name);
|
||||
if (zone->inst) delete_fluid_inst (zone->inst);
|
||||
FLUID_FREE (zone->name);
|
||||
delete_fluid_inst (zone->inst);
|
||||
FLUID_FREE(zone);
|
||||
}
|
||||
|
||||
|
@ -1402,11 +1396,12 @@ new_fluid_inst()
|
|||
/*
|
||||
* delete_fluid_inst
|
||||
*/
|
||||
int
|
||||
void
|
||||
delete_fluid_inst(fluid_inst_t* inst)
|
||||
{
|
||||
fluid_inst_zone_t* zone;
|
||||
int err = FLUID_OK;
|
||||
|
||||
fluid_return_if_fail(inst != NULL);
|
||||
|
||||
delete_fluid_inst_zone(inst->global_zone);
|
||||
inst->global_zone = NULL;
|
||||
|
@ -1418,7 +1413,6 @@ delete_fluid_inst(fluid_inst_t* inst)
|
|||
zone = inst->zone;
|
||||
}
|
||||
FLUID_FREE(inst);
|
||||
return err;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1561,8 +1555,7 @@ delete_fluid_inst_zone(fluid_inst_zone_t* zone)
|
|||
{
|
||||
fluid_mod_t *mod, *tmp;
|
||||
|
||||
if(zone == NULL)
|
||||
return;
|
||||
fluid_return_if_fail(zone != NULL);
|
||||
|
||||
mod = zone->mod;
|
||||
while (mod) /* delete the modulators */
|
||||
|
@ -1807,8 +1800,7 @@ new_fluid_sample()
|
|||
void
|
||||
delete_fluid_sample(fluid_sample_t* sample)
|
||||
{
|
||||
if(sample == NULL)
|
||||
return;
|
||||
fluid_return_if_fail(sample != NULL);
|
||||
|
||||
if (sample->sampletype & FLUID_SAMPLETYPE_OGG_VORBIS)
|
||||
{
|
||||
|
|
|
@ -416,7 +416,7 @@ struct _fluid_defpreset_t
|
|||
};
|
||||
|
||||
fluid_defpreset_t* new_fluid_defpreset(fluid_defsfont_t* sfont);
|
||||
int delete_fluid_defpreset(fluid_defpreset_t* preset);
|
||||
void delete_fluid_defpreset(fluid_defpreset_t* preset);
|
||||
fluid_defpreset_t* fluid_defpreset_next(fluid_defpreset_t* preset);
|
||||
int fluid_defpreset_import_sfont(fluid_defpreset_t* preset, SFPreset* sfpreset, fluid_defsfont_t* sfont);
|
||||
int fluid_defpreset_set_global_zone(fluid_defpreset_t* preset, fluid_preset_zone_t* zone);
|
||||
|
@ -462,7 +462,7 @@ struct _fluid_inst_t
|
|||
};
|
||||
|
||||
fluid_inst_t* new_fluid_inst(void);
|
||||
int delete_fluid_inst(fluid_inst_t* inst);
|
||||
void delete_fluid_inst(fluid_inst_t* inst);
|
||||
int fluid_inst_import_sfont(fluid_inst_t* inst, SFInst *sfinst, fluid_defsfont_t* sfont);
|
||||
int fluid_inst_set_global_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone);
|
||||
int fluid_inst_add_zone(fluid_inst_t* inst, fluid_inst_zone_t* zone);
|
||||
|
|
Loading…
Reference in a new issue