Change key type of g_hash_table 98/81898/1 accepted/tizen/common/20160803.193157 accepted/tizen/ivi/20160804.080750 accepted/tizen/mobile/20160804.080842 accepted/tizen/tv/20160804.080708 accepted/tizen/wearable/20160804.080523 submit/tizen/20160803.012753
authorseungha.son <seungha.son@samsung.com>
Fri, 29 Jul 2016 06:29:33 +0000 (15:29 +0900)
committerseungha.son <seungha.son@samsung.com>
Fri, 29 Jul 2016 06:30:25 +0000 (15:30 +0900)
Signed-off-by: seungha.son <seungha.son@samsung.com>
Change-Id: I6ccfae25aa3773806fb644aca3a82c86baf97745

src/badge_service.c
src/notification_service.c
src/service_common.c
src/shortcut_service.c

index 56dce5f..ffd48b3 100755 (executable)
@@ -319,7 +319,7 @@ int badge_insert(GVariant *parameters, GVariant **reply_body, uid_t uid)
                return BADGE_ERROR_OUT_OF_MEMORY;
        }
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
        ret = send_notify(body, "insert_badge_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
        g_variant_unref(body);
 
@@ -370,7 +370,7 @@ int badge_delete(GVariant *parameters, GVariant **reply_body, uid_t uid)
                return BADGE_ERROR_OUT_OF_MEMORY;
        }
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
        ret = send_notify(body, "delete_badge_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
        g_variant_unref(body);
 
@@ -420,7 +420,7 @@ int badge_set_badge_count(GVariant *parameters, GVariant **reply_body, uid_t uid
                return BADGE_ERROR_OUT_OF_MEMORY;
        }
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
        ret = send_notify(body, "set_badge_count_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
        g_variant_unref(body);
 
@@ -506,7 +506,7 @@ int badge_set_display_option(GVariant *parameters, GVariant **reply_body, uid_t
                return BADGE_ERROR_OUT_OF_MEMORY;
        }
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
        ret = send_notify(body, "set_disp_option_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
        g_variant_unref(body);
 
@@ -599,7 +599,7 @@ int badge_set_setting_property(GVariant *parameters, GVariant **reply_body, uid_
                                return BADGE_ERROR_OUT_OF_MEMORY;
                        }
 
-                       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+                       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
                        ret = send_notify(body, "set_disp_option_notify", monitoring_list, PROVIDER_BADGE_INTERFACE_NAME);
                        g_variant_unref(body);
                        if (ret != BADGE_ERROR_NONE) {
@@ -660,7 +660,7 @@ HAPI int badge_service_init(void)
 {
        int result;
 
-       _monitoring_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_monitoring_list);
+       _monitoring_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_monitoring_list);
        result = badge_db_init();
        if (result != BADGE_ERROR_NONE) {
                ErrPrint("badge db init fail %d", result);
index 8a0d58f..f793475 100755 (executable)
@@ -376,7 +376,7 @@ int notification_add_noti(GVariant *parameters, GVariant **reply_body, uid_t uid
                if (ret != NOTIFICATION_ERROR_NONE)
                        return ret;
 
-               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &noti_uid);
+               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(noti_uid));
                if (ret == NOTIFICATION_ERROR_NONE) {
                        ret = notification_noti_check_tag(noti);
                        if (ret == NOTIFICATION_ERROR_NOT_EXIST_ID)
@@ -450,7 +450,7 @@ int notification_update_noti(GVariant *parameters, GVariant **reply_body, uid_t
                if (ret != NOTIFICATION_ERROR_NONE)
                        return ret;
 
-               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &noti_uid);
+               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(noti_uid));
                if (ret == NOTIFICATION_ERROR_NONE)
                        ret = _update_noti(reply_body, noti, monitoring_list);
 
@@ -765,7 +765,7 @@ int notification_refresh_noti(GVariant *parameters, GVariant **reply_body, uid_t
        if (ret != NOTIFICATION_ERROR_NONE)
                return ret;
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
        ret = send_notify(parameters, "refresh_noti_notify", monitoring_list, PROVIDER_NOTI_INTERFACE_NAME);
        if (ret != NOTIFICATION_ERROR_NONE) {
                ErrPrint("failed to send notify:%d\n", ret);
@@ -810,7 +810,7 @@ int notification_del_noti_single(GVariant *parameters, GVariant **reply_body, ui
                        ErrPrint("cannot make gvariant to noti");
                        return NOTIFICATION_ERROR_OUT_OF_MEMORY;
                }
-               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
                ret = send_notify(body, "delete_single_notify", monitoring_list, PROVIDER_NOTI_INTERFACE_NAME);
                g_variant_unref(body);
                if (ret != NOTIFICATION_ERROR_NONE) {
@@ -865,7 +865,7 @@ int notification_del_noti_multiple(GVariant *parameters, GVariant **reply_body,
                        g_variant_builder_add(builder, "(i)", *(list_deleted + i));
                }
                deleted_noti_list = g_variant_new("(a(i)i)", builder, param_uid);
-               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &param_uid);
+               monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(param_uid));
                ret = send_notify(deleted_noti_list, "delete_multiple_notify", monitoring_list, PROVIDER_NOTI_INTERFACE_NAME);
 
                g_variant_builder_unref(builder);
@@ -1270,7 +1270,7 @@ HAPI int notification_service_init(void)
 {
        int ret;
 
-       _monitoring_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_monitoring_list);
+       _monitoring_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_monitoring_list);
        ret = notification_db_init();
        if (ret != NOTIFICATION_ERROR_NONE) {
                ErrPrint("notification db init fail %d", ret);
index 1a29da8..8bb23ab 100755 (executable)
@@ -167,7 +167,6 @@ int service_register(GVariant *parameters, GVariant **reply_body, const gchar *s
        monitoring_info_s *m_info = NULL;
        uid_t request_uid = 0;
        GList *monitoring_list = NULL;
-       int *hash_key;
 
        if (sender == NULL)
                return SERVICE_COMMON_ERROR_IO_ERROR;
@@ -177,7 +176,7 @@ int service_register(GVariant *parameters, GVariant **reply_body, const gchar *s
                return SERVICE_COMMON_ERROR_IO_ERROR;
 
        DbgPrint("service_register : uid %d , request_uid %d", uid, request_uid);
-       monitoring_list = (GList *)g_hash_table_lookup(*monitoring_hash, &request_uid);
+       monitoring_list = (GList *)g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(request_uid));
        added_list = g_list_find_custom(monitoring_list, bus_name,
                        (GCompareFunc)_monitoring_app_list_compare_cb);
 
@@ -210,10 +209,8 @@ int service_register(GVariant *parameters, GVariant **reply_body, const gchar *s
                monitoring_list = g_list_append(monitoring_list, strdup(bus_name));
                DbgPrint("service_register : register success sender is %s , length : %d",
                                sender, g_list_length(monitoring_list));
-               if (g_hash_table_lookup(*monitoring_hash, &request_uid) == NULL) {
-                       hash_key = (int *)calloc(1, sizeof(int));
-                       *hash_key = request_uid;
-                       g_hash_table_insert(*monitoring_hash, hash_key, monitoring_list);
+               if (g_hash_table_lookup(*monitoring_hash, GUINT_TO_POINTER(request_uid)) == NULL) {
+                       g_hash_table_insert(*monitoring_hash, GUINT_TO_POINTER(request_uid), monitoring_list);
                }
 
        } else {
index 1184bf6..1142251 100755 (executable)
@@ -57,7 +57,7 @@ static void _shortcut_dbus_method_call_handler(GDBusConnection *conn,
        uid_t uid = get_sender_uid(sender);
        GList *monitoring_list = NULL;
 
-       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, &uid);
+       monitoring_list = (GList *)g_hash_table_lookup(_monitoring_hash, GUINT_TO_POINTER(uid));
        if (g_strcmp0(method_name, "shortcut_service_register") == 0)
                ret = service_register(parameters, &reply_body, sender,
                 _on_name_appeared, _on_name_vanished, &_monitoring_hash, uid);
@@ -251,7 +251,7 @@ HAPI int shortcut_service_init(void)
 {
        DbgPrint("Successfully initiated\n");
        int result;
-       _monitoring_hash = g_hash_table_new_full(g_int_hash, g_int_equal, g_free, free_monitoring_list);
+       _monitoring_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, free_monitoring_list);
        result = shortcut_register_dbus_interface();
        if (result != SERVICE_COMMON_ERROR_NONE) {
                ErrPrint("shortcut register dbus fail %d", result);