remove uncovered code
[platform/core/pim/contacts-service.git] / common / ctsvc_handle.c
1 /*
2  * Contacts Service
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include "ctsvc_internal.h"
21 #include "ctsvc_handle.h"
22
23 int ctsvc_handle_create(contacts_h *contact)
24 {
25         RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
26         ctsvc_base_s *base = calloc(1, sizeof(ctsvc_base_s));
27         if (NULL == base) {
28                 /* LCOV_EXCL_START */
29                 ERR("calloc() Fail");
30                 return CONTACTS_ERROR_OUT_OF_MEMORY;
31                 /* LCOV_EXCL_STOP */
32         }
33         *contact = (contacts_h)base;
34         return CONTACTS_ERROR_NONE;
35 }
36
37 int ctsvc_handle_destroy(contacts_h contact)
38 {
39         RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
40         ctsvc_base_s *base = (ctsvc_base_s*)contact;
41         free(base);
42         base = NULL;
43         return CONTACTS_ERROR_NONE;
44 }
45
46 int ctsvc_handle_clone(contacts_h contact, contacts_h *pcontact)
47 {
48         RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
49         RETV_IF(NULL == pcontact, CONTACTS_ERROR_INVALID_PARAMETER);
50
51         ctsvc_base_s *base = (ctsvc_base_s*)contact;
52         ctsvc_base_s *clone = calloc(1, sizeof(ctsvc_base_s));
53         if (NULL == clone) {
54                 /* LCOV_EXCL_START */
55                 ERR("calloc() Fail");
56                 return CONTACTS_ERROR_OUT_OF_MEMORY;
57                 /* LCOV_EXCL_STOP */
58         }
59         clone->connection_count = base->connection_count;
60         clone->version = base->version;
61
62         *pcontact = (contacts_h)clone;
63
64         return CONTACTS_ERROR_NONE;
65 }