forked from enlightenment/enlightenment
mixer: factorise get/free card names
e_mod_mixer_card_names_free in e_mod_mixer.c is used to free Eina_List build by e_mod_mixer_card_names_get
This commit is contained in:
parent
640b339a80
commit
488904c95d
|
@ -312,7 +312,7 @@ _create_cards(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
|
|
||||||
app->card = e_mod_mixer_card_default_get();
|
app->card = e_mod_mixer_card_default_get();
|
||||||
app->cards = e_mod_mixer_cards_get();
|
app->cards = e_mod_mixer_card_names_get();
|
||||||
if (eina_list_count(app->cards) < 2)
|
if (eina_list_count(app->cards) < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -440,7 +440,7 @@ _mixer_app_dialog_del(E_Dialog *dialog, E_Mixer_App_Dialog_Data *app)
|
||||||
eina_stringshare_del(app->card);
|
eina_stringshare_del(app->card);
|
||||||
eina_stringshare_del(app->channel_name);
|
eina_stringshare_del(app->channel_name);
|
||||||
if (app->cards)
|
if (app->cards)
|
||||||
e_mod_mixer_cards_free(app->cards);
|
e_mod_mixer_card_names_free(app->cards);
|
||||||
if (app->channels_infos)
|
if (app->channels_infos)
|
||||||
e_mod_mixer_channels_info_free(app->channels_infos);
|
e_mod_mixer_channels_info_free(app->channels_infos);
|
||||||
e_mod_mixer_del(app->sys);
|
e_mod_mixer_del(app->sys);
|
||||||
|
|
|
@ -50,7 +50,7 @@ _mixer_fill_cards_info(E_Config_Dialog_Data *cfdata)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
cfdata->card_num = -1;
|
cfdata->card_num = -1;
|
||||||
cfdata->cards = e_mod_mixer_cards_get();
|
cfdata->cards = e_mod_mixer_card_names_get();
|
||||||
cfdata->cards_names = NULL;
|
cfdata->cards_names = NULL;
|
||||||
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
EINA_LIST_FOREACH(cfdata->cards, l, card)
|
||||||
{
|
{
|
||||||
|
@ -138,7 +138,7 @@ _free_data(E_Config_Dialog *dialog, E_Config_Dialog_Data *cfdata)
|
||||||
if (cfdata->channels_names)
|
if (cfdata->channels_names)
|
||||||
e_mod_mixer_channels_names_free(cfdata->channels_names);
|
e_mod_mixer_channels_names_free(cfdata->channels_names);
|
||||||
if (cfdata->cards)
|
if (cfdata->cards)
|
||||||
e_mod_mixer_cards_free(cfdata->cards);
|
e_mod_mixer_card_names_free(cfdata->cards);
|
||||||
|
|
||||||
eina_stringshare_del(cfdata->card);
|
eina_stringshare_del(cfdata->card);
|
||||||
eina_stringshare_del(cfdata->channel_name);
|
eina_stringshare_del(cfdata->channel_name);
|
||||||
|
|
|
@ -18,8 +18,7 @@ E_Mixer_Cb e_mod_mixer_channel_free;
|
||||||
E_Mixer_Cb e_mod_mixer_channels_get;
|
E_Mixer_Cb e_mod_mixer_channels_get;
|
||||||
E_Mixer_Cb e_mod_mixer_channels_names_get;
|
E_Mixer_Cb e_mod_mixer_channels_names_get;
|
||||||
E_Mixer_Cb e_mod_mixer_card_name_get;
|
E_Mixer_Cb e_mod_mixer_card_name_get;
|
||||||
E_Mixer_Cb e_mod_mixer_cards_get;
|
E_Mixer_Cb e_mod_mixer_card_names_get;
|
||||||
E_Mixer_Cb e_mod_mixer_cards_free;
|
|
||||||
E_Mixer_Cb e_mod_mixer_card_default_get;
|
E_Mixer_Cb e_mod_mixer_card_default_get;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -41,8 +40,7 @@ e_mixer_default_setup(void)
|
||||||
e_mod_mixer_channels_get = (void *)e_mixer_system_get_channels;
|
e_mod_mixer_channels_get = (void *)e_mixer_system_get_channels;
|
||||||
e_mod_mixer_channels_names_get = (void *)e_mixer_system_get_channels_names;
|
e_mod_mixer_channels_names_get = (void *)e_mixer_system_get_channels_names;
|
||||||
e_mod_mixer_card_name_get = (void *)e_mixer_system_get_card_name;
|
e_mod_mixer_card_name_get = (void *)e_mixer_system_get_card_name;
|
||||||
e_mod_mixer_cards_get = (void *)e_mixer_system_get_cards;
|
e_mod_mixer_card_names_get = (void *)e_mixer_system_get_cards;
|
||||||
e_mod_mixer_cards_free = (void *)e_mixer_system_free_cards;
|
|
||||||
e_mod_mixer_card_default_get = (void *)e_mixer_system_get_default_card;
|
e_mod_mixer_card_default_get = (void *)e_mixer_system_get_default_card;
|
||||||
_mixer_using_default = EINA_TRUE;
|
_mixer_using_default = EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
@ -66,8 +64,7 @@ e_mixer_pulse_setup()
|
||||||
e_mod_mixer_channels_get = (void *)e_mixer_pulse_get_channels;
|
e_mod_mixer_channels_get = (void *)e_mixer_pulse_get_channels;
|
||||||
e_mod_mixer_channels_names_get = (void *)e_mixer_pulse_get_channels_names;
|
e_mod_mixer_channels_names_get = (void *)e_mixer_pulse_get_channels_names;
|
||||||
e_mod_mixer_card_name_get = (void *)e_mixer_pulse_get_card_name;
|
e_mod_mixer_card_name_get = (void *)e_mixer_pulse_get_card_name;
|
||||||
e_mod_mixer_cards_get = (void *)e_mixer_pulse_get_cards;
|
e_mod_mixer_card_names_get = (void *)e_mixer_pulse_get_cards;
|
||||||
e_mod_mixer_cards_free = (void *)e_mixer_pulse_free_cards;
|
|
||||||
e_mod_mixer_card_default_get = (void *)e_mixer_pulse_get_default_card;
|
e_mod_mixer_card_default_get = (void *)e_mixer_pulse_get_default_card;
|
||||||
_mixer_using_default = EINA_FALSE;
|
_mixer_using_default = EINA_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -110,3 +107,11 @@ e_mod_mixer_channels_names_free(Eina_List *list)
|
||||||
EINA_LIST_FREE(list, str)
|
EINA_LIST_FREE(list, str)
|
||||||
eina_stringshare_del(str);
|
eina_stringshare_del(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
e_mod_mixer_card_names_free(Eina_List *list)
|
||||||
|
{
|
||||||
|
const char *str;
|
||||||
|
EINA_LIST_FREE(list, str)
|
||||||
|
eina_stringshare_del(str);
|
||||||
|
}
|
||||||
|
|
|
@ -47,13 +47,13 @@ extern E_Mixer_Cb e_mod_mixer_channel_del;
|
||||||
extern E_Mixer_Cb e_mod_mixer_channel_free;
|
extern E_Mixer_Cb e_mod_mixer_channel_free;
|
||||||
extern E_Mixer_Cb e_mod_mixer_channels_names_get;
|
extern E_Mixer_Cb e_mod_mixer_channels_names_get;
|
||||||
extern E_Mixer_Cb e_mod_mixer_card_name_get;
|
extern E_Mixer_Cb e_mod_mixer_card_name_get;
|
||||||
extern E_Mixer_Cb e_mod_mixer_cards_get;
|
extern E_Mixer_Cb e_mod_mixer_card_names_get;
|
||||||
extern E_Mixer_Cb e_mod_mixer_cards_free;
|
|
||||||
extern E_Mixer_Cb e_mod_mixer_card_default_get;
|
extern E_Mixer_Cb e_mod_mixer_card_default_get;
|
||||||
|
|
||||||
Eina_List *e_mod_mixer_channels_info_get(E_Mixer_System *sys);
|
Eina_List *e_mod_mixer_channels_info_get(E_Mixer_System *sys);
|
||||||
void e_mod_mixer_channels_info_free(Eina_List*);
|
void e_mod_mixer_channels_info_free(Eina_List*);
|
||||||
void e_mod_mixer_channels_names_free(Eina_List*);
|
void e_mod_mixer_channels_names_free(Eina_List*);
|
||||||
|
void e_mod_mixer_card_names_free(Eina_List*);
|
||||||
|
|
||||||
void e_mixer_default_setup(void);
|
void e_mixer_default_setup(void);
|
||||||
void e_mixer_pulse_setup();
|
void e_mixer_pulse_setup();
|
||||||
|
@ -65,7 +65,6 @@ E_Mixer_System *e_mixer_system_new(const char *card);
|
||||||
void e_mixer_system_del(E_Mixer_System *self);
|
void e_mixer_system_del(E_Mixer_System *self);
|
||||||
|
|
||||||
Eina_List *e_mixer_system_get_cards(void);
|
Eina_List *e_mixer_system_get_cards(void);
|
||||||
void e_mixer_system_free_cards(Eina_List *cards);
|
|
||||||
const char *e_mixer_system_get_default_card(void);
|
const char *e_mixer_system_get_default_card(void);
|
||||||
const char *e_mixer_system_get_card_name(const char *card);
|
const char *e_mixer_system_get_card_name(const char *card);
|
||||||
const char *e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel);
|
const char *e_mixer_system_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel);
|
||||||
|
@ -96,7 +95,6 @@ E_Mixer_System *e_mixer_pulse_new(const char *name);
|
||||||
void e_mixer_pulse_del(E_Mixer_System *self);
|
void e_mixer_pulse_del(E_Mixer_System *self);
|
||||||
|
|
||||||
Eina_List *e_mixer_pulse_get_cards(void);
|
Eina_List *e_mixer_pulse_get_cards(void);
|
||||||
void e_mixer_pulse_free_cards(Eina_List *cards);
|
|
||||||
const char *e_mixer_pulse_get_default_card(void);
|
const char *e_mixer_pulse_get_default_card(void);
|
||||||
const char *e_mixer_pulse_get_card_name(const char *card);
|
const char *e_mixer_pulse_get_card_name(const char *card);
|
||||||
const char *e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel);
|
const char *e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel);
|
||||||
|
|
|
@ -245,15 +245,6 @@ e_mixer_system_get_cards(void)
|
||||||
return cards;
|
return cards;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
e_mixer_system_free_cards(Eina_List *cards)
|
|
||||||
{
|
|
||||||
const char *card;
|
|
||||||
|
|
||||||
EINA_LIST_FREE(cards, card)
|
|
||||||
eina_stringshare_del(card);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
e_mixer_system_get_default_card(void)
|
e_mixer_system_get_default_card(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,13 +36,7 @@ e_mixer_system_get_cards(void)
|
||||||
{
|
{
|
||||||
_e_mixer_dummy_set();
|
_e_mixer_dummy_set();
|
||||||
|
|
||||||
return eina_list_append(NULL, _name);
|
return eina_list_append(NULL, eina_stringshare_ref(_name));
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
e_mixer_system_free_cards(Eina_List *cards)
|
|
||||||
{
|
|
||||||
eina_list_free(cards);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
|
|
|
@ -448,12 +448,6 @@ e_mixer_pulse_get_cards(void)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
e_mixer_pulse_free_cards(Eina_List *cards)
|
|
||||||
{
|
|
||||||
E_FREE_LIST(cards, eina_stringshare_del);
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
e_mixer_pulse_get_default_card(void)
|
e_mixer_pulse_get_default_card(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue