3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 * Licensed under the Apache License, Version 2.0 (the License);
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 #include "utility/sync_util.h"
21 #include "engine-controller/hash_set.h"
23 #ifndef SYNC_AGENT_LOG
25 #define LOG_TAG "AF_EC"
28 ec_hash_set_t *ec_hash_set_create(void)
32 ec_hash_set_t *hash_set = (ec_hash_set_t *) calloc(1, sizeof(ec_hash_set_t));
33 if (hash_set == NULL) {
37 hash_set->hash_table = NULL;
47 void ec_hash_set_free(ec_hash_set_t * hash_set)
51 if (hash_set != NULL) {
52 if (hash_set->hash_table != NULL) {
53 g_hash_table_destroy(hash_set->hash_table);
62 sync_agent_ec_boolean ec_hash_set_add(ec_hash_set_t * hash_set, sync_agent_ec_constpointer element)
66 sync_agent_ec_boolean success = true;
68 if (hash_set == NULL) {
69 _DEBUG_ERROR("hash_set == NULL\n");
74 if (hash_set->hash_table == NULL) {
75 hash_set->hash_table = g_hash_table_new(g_direct_hash, g_direct_equal);
78 g_hash_table_insert(hash_set->hash_table, (gpointer) element, (gpointer) element);
85 GList *ec_hash_set_get_element_list(ec_hash_set_t * hash_set)
89 GList *element_list = NULL;
90 if (hash_set == NULL) {
91 _DEBUG_ERROR("hash_set == NULL\n");
95 if (hash_set->hash_table != NULL) {
96 element_list = g_hash_table_get_values(hash_set->hash_table);