2 * Copyright (c) 2018 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.
19 #include "ttd-app-data.h"
21 struct __ttd_app_data {
27 ttd_app_data *ttd_app_data_new(const char *project, const char *data)
29 ttd_app_data *app_data = NULL;
31 retv_if(!project, NULL);
34 app_data = g_try_malloc0(sizeof(ttd_app_data));
35 retv_if(!app_data, NULL);
37 app_data->p_name = g_strdup(project);
38 app_data->data = g_strdup(data);
43 void ttd_app_data_free(ttd_app_data *app_data)
48 g_free(app_data->p_name);
49 g_free(app_data->data);
53 int ttd_app_data_set_retry_count(
54 ttd_app_data *app_data, unsigned int count)
56 retv_if(!app_data, -1);
58 app_data->retry = count;
63 const char *ttd_app_data_get_project_name(ttd_app_data *app_data)
65 retv_if(!app_data, NULL);
66 return app_data->p_name;
69 const char *ttd_app_data_get_data(ttd_app_data *app_data)
71 retv_if(!app_data, NULL);
72 return app_data->data;
75 int ttd_app_data_get_retry_count(
76 ttd_app_data *app_data, unsigned int *count)
78 retv_if(!app_data, -1);
81 *count = app_data->retry;