e_mixer: factorise get/free card names
authorJérémy Zurcher <jeremy@asynk.ch>
Thu, 14 Feb 2013 20:28:10 +0000 (20:28 +0000)
committerJérémy Zurcher <jeremy@asynk.ch>
Thu, 14 Feb 2013 20:28:10 +0000 (20:28 +0000)
SVN revision: 83911

src/modules/mixer/app_mixer.c
src/modules/mixer/conf_gadget.c
src/modules/mixer/e_mod_mixer.c
src/modules/mixer/e_mod_mixer.h
src/modules/mixer/sys_alsa.c
src/modules/mixer/sys_dummy.c
src/modules/mixer/sys_pulse.c

index f6acd4f..3cc2149 100644 (file)
@@ -312,7 +312,7 @@ _create_cards(E_Dialog *dialog __UNUSED__, Evas *evas, E_Mixer_App_Dialog_Data *
    Eina_List *l;
 
    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)
      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->channel_name);
    if (app->cards)
-     e_mod_mixer_cards_free(app->cards);
+     e_mod_mixer_card_names_free(app->cards);
    if (app->channels_infos)
      e_mod_mixer_channels_info_free(app->channels_infos);
    e_mod_mixer_del(app->sys);
index 238f8d3..858036d 100644 (file)
@@ -50,7 +50,7 @@ _mixer_fill_cards_info(E_Config_Dialog_Data *cfdata)
    int i = 0;
 
    cfdata->card_num = -1;
-   cfdata->cards = e_mod_mixer_cards_get();
+   cfdata->cards = e_mod_mixer_card_names_get();
    cfdata->cards_names = NULL;
    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)
      e_mod_mixer_channels_names_free(cfdata->channels_names);
    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->channel_name);
index 36a36a3..a3ce662 100644 (file)
@@ -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_names_get;
 E_Mixer_Cb e_mod_mixer_card_name_get;
-E_Mixer_Cb e_mod_mixer_cards_get;
-E_Mixer_Cb e_mod_mixer_cards_free;
+E_Mixer_Cb e_mod_mixer_card_names_get;
 E_Mixer_Cb e_mod_mixer_card_default_get;
 
 void
@@ -41,8 +40,7 @@ e_mixer_default_setup(void)
    e_mod_mixer_channels_get = (void *)e_mixer_alsa_get_channels;
    e_mod_mixer_channels_names_get = (void *)e_mixer_alsa_get_channels_names;
    e_mod_mixer_card_name_get = (void *)e_mixer_alsa_get_card_name;
-   e_mod_mixer_cards_get = (void *)e_mixer_alsa_get_cards;
-   e_mod_mixer_cards_free = (void *)e_mixer_alsa_free_cards;
+   e_mod_mixer_card_names_get = (void *)e_mixer_alsa_get_cards;
    e_mod_mixer_card_default_get = (void *)e_mixer_alsa_get_default_card;
    _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_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_cards_get = (void *)e_mixer_pulse_get_cards;
-   e_mod_mixer_cards_free = (void *)e_mixer_pulse_free_cards;
+   e_mod_mixer_card_names_get = (void *)e_mixer_pulse_get_cards;
    e_mod_mixer_card_default_get = (void *)e_mixer_pulse_get_default_card;
    _mixer_using_default = EINA_FALSE;
 }
@@ -111,3 +108,11 @@ e_mod_mixer_channels_names_free(Eina_List *list)
      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);
+}
+
index 5999ee3..b10a473 100644 (file)
@@ -48,13 +48,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_channels_names_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_cards_free;
+extern E_Mixer_Cb e_mod_mixer_card_names_get;
 extern E_Mixer_Cb e_mod_mixer_card_default_get;
 
 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_names_free(Eina_List*);
+void e_mod_mixer_card_names_free(Eina_List*);
 
 void e_mixer_default_setup(void);
 void e_mixer_pulse_setup();
@@ -66,7 +66,6 @@ E_Mixer_System *e_mixer_alsa_new(const char *card);
 void e_mixer_alsa_del(E_Mixer_System *self);
 
 Eina_List *e_mixer_alsa_get_cards(void);
-void e_mixer_alsa_free_cards(Eina_List *cards);
 const char *e_mixer_alsa_get_default_card(void);
 const char *e_mixer_alsa_get_card_name(const char *card);
 const char *e_mixer_alsa_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);
 
 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_card_name(const char *card);
 const char *e_mixer_pulse_get_channel_name(E_Mixer_System *self, E_Mixer_Channel *channel);
index 2d0b698..8f321b7 100644 (file)
@@ -245,15 +245,6 @@ e_mixer_alsa_get_cards(void)
    return cards;
 }
 
-void
-e_mixer_alsa_free_cards(Eina_List *cards)
-{
-   const char *card;
-
-   EINA_LIST_FREE(cards, card)
-     eina_stringshare_del(card);
-}
-
 const char *
 e_mixer_alsa_get_default_card(void)
 {
index 0598f83..82036ac 100644 (file)
@@ -37,13 +37,7 @@ e_mixer_system_get_cards(void)
 {
    _e_mixer_dummy_set();
 
-   return eina_list_append(NULL, _name);
-}
-
-void
-e_mixer_system_free_cards(Eina_List *cards)
-{
-   eina_list_free(cards);
+   return eina_list_append(NULL, eina_stringshare_ref(_name));
 }
 
 const char *
index d623dfa..103a2e9 100644 (file)
@@ -459,12 +459,6 @@ e_mixer_pulse_get_cards(void)
    return ret;
 }
 
-void
-e_mixer_pulse_free_cards(Eina_List *cards)
-{
-   E_FREE_LIST(cards, eina_stringshare_del);
-}
-
 const char *
 e_mixer_pulse_get_default_card(void)
 {