Updating tcore_server_get_cp_name_list function to rerturn GSList *.
authorSuresh Kumar Narasimhaiah <suresh.n@samsung.com>
Thu, 14 Mar 2013 19:15:26 +0000 (00:45 +0530)
committerwootak.jung <wootak.jung@samsung.com>
Sun, 24 Mar 2013 09:03:13 +0000 (18:03 +0900)
include/server.h
src/server.c

index a488150..ae36280 100644 (file)
@@ -74,7 +74,7 @@ gboolean tcore_server_register_modem(Server *s, TcorePlugin *modem_iface_plugin)
 void tcore_server_unregister_modem(Server *s, TcorePlugin *modem_iface_plugin);
 gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
                                                        TcorePlugin *modem_plugin);
-char **tcore_server_get_cp_name_list(Server *s);
+GSList *tcore_server_get_cp_name_list(Server *s);
 const char *tcore_server_get_cp_name_by_plugin(TcorePlugin *plugin);
 
 gboolean tcore_server_add_cp_mapping_tbl_entry(TcorePlugin *modem_iface_plugin,
index 0dd385f..aefa13b 100644 (file)
@@ -770,9 +770,9 @@ gboolean tcore_server_update_modem_plugin(TcorePlugin *modem_iface_plugin,
        return TRUE;
 }
 
-char **tcore_server_get_cp_name_list(Server *s)
+GSList *tcore_server_get_cp_name_list(Server *s)
 {
-       char **cp_name_list = NULL;
+       GSList *cp_name_list = NULL;
        GSList *list;
        unsigned int list_count;
        TcoreModem *modem;
@@ -790,6 +790,18 @@ char **tcore_server_get_cp_name_list(Server *s)
                return NULL;
        }
 
+#if 1
+       for (list = s->modems; list; list = list->next) {
+               modem = list->data;
+               if (modem == NULL) {
+                       dbg("No modem - continue");
+                       continue;
+               }
+
+               dbg("[%d] CP Name: [%s]", i++, modem->cp_name);
+               cp_name_list = g_slist_append(cp_name_list, g_strdup(modem->cp_name));
+       }
+#else
        /* (+1) is considered for NULL string to define the last string */
        cp_name_list = g_try_new0(char *, list_count);
        if (cp_name_list == NULL) {
@@ -805,10 +817,11 @@ char **tcore_server_get_cp_name_list(Server *s)
                }
 
                cp_name_list[i] = g_strdup(modem->cp_name);
-               dbg("CP Name[%d] = %s", i, cp_name_list[i]);
+               dbg("[%d] CP Name: [%s]", i, cp_name_list[i]);
 
                i++;
        }
+#endif
 
        /* 'cp_name_list' would be freed by the calling function */
        return cp_name_list;