4 * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #include "ctsvc_internal.h"
21 #include "ctsvc_handle.h"
23 int ctsvc_handle_create(contacts_h *contact)
25 RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
26 ctsvc_base_s *base = calloc(1, sizeof(ctsvc_base_s));
30 return CONTACTS_ERROR_OUT_OF_MEMORY;
33 *contact = (contacts_h)base;
34 return CONTACTS_ERROR_NONE;
37 int ctsvc_handle_destroy(contacts_h contact)
39 RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
40 ctsvc_base_s *base = (ctsvc_base_s*)contact;
43 return CONTACTS_ERROR_NONE;
46 int ctsvc_handle_clone(contacts_h contact, contacts_h *pcontact)
48 RETV_IF(NULL == contact, CONTACTS_ERROR_INVALID_PARAMETER);
49 RETV_IF(NULL == pcontact, CONTACTS_ERROR_INVALID_PARAMETER);
51 ctsvc_base_s *base = (ctsvc_base_s*)contact;
52 ctsvc_base_s *clone = calloc(1, sizeof(ctsvc_base_s));
56 return CONTACTS_ERROR_OUT_OF_MEMORY;
59 clone->connection_count = base->connection_count;
60 clone->version = base->version;
62 *pcontact = (contacts_h)clone;
64 return CONTACTS_ERROR_NONE;