2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.1 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
23 #include <livebox-errno.h>
33 char *pkgname; /*!< Slave package name */
42 HAPI int abi_add_entry(const char *abi, const char *pkgname)
46 item = malloc(sizeof(*item));
48 ErrPrint("Failed to add a new entry for abi[%s - %s]\n", abi, pkgname);
49 return LB_STATUS_ERROR_MEMORY;
52 item->abi = strdup(abi);
54 ErrPrint("Heap: %s\n", strerror(errno));
56 return LB_STATUS_ERROR_MEMORY;
59 item->pkgname = strdup(pkgname);
61 ErrPrint("Heap: %s\n", strerror(errno));
64 return LB_STATUS_ERROR_MEMORY;
67 s_abi.list = eina_list_append(s_abi.list, item);
68 return LB_STATUS_SUCCESS;
71 HAPI int abi_update_entry(const char *abi, const char *pkgname)
78 _pkgname = strdup(pkgname);
80 ErrPrint("Heap: %s\n", strerror(errno));
81 return LB_STATUS_ERROR_MEMORY;
84 EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
85 if (!strcasecmp(item->abi, abi)) {
86 DbgFree(item->pkgname);
87 item->pkgname = _pkgname;
93 return LB_STATUS_ERROR_NOT_EXIST;
96 HAPI int abi_del_entry(const char *abi)
102 EINA_LIST_FOREACH_SAFE(s_abi.list, l, n, item) {
103 if (!strcasecmp(item->abi, abi)) {
104 s_abi.list = eina_list_remove(s_abi.list, item);
106 DbgFree(item->pkgname);
108 return LB_STATUS_SUCCESS;
112 return LB_STATUS_ERROR_NOT_EXIST;
115 HAPI void abi_del_all(void)
119 EINA_LIST_FREE(s_abi.list, item) {
121 DbgFree(item->pkgname);
126 HAPI const char *abi_find_slave(const char *abi)
131 EINA_LIST_FOREACH(s_abi.list, l, item) {
132 if (!strcasecmp(item->abi, abi)) {
133 return item->pkgname;
140 HAPI const char *abi_find_by_pkgname(const char *pkgname)
145 EINA_LIST_FOREACH(s_abi.list, l, item) {
146 if (!strcmp(item->pkgname, pkgname)) {