/src/fluent-bit/lib/cprofiles/src/cprof_function.c
Line | Count | Source |
1 | | /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* CProfiles |
4 | | * ========= |
5 | | * Copyright (C) 2024 The CProfiles Authors |
6 | | * |
7 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
8 | | * you may not use this file except in compliance with the License. |
9 | | * You may obtain a copy of the License at |
10 | | * |
11 | | * http://www.apache.org/licenses/LICENSE-2.0 |
12 | | * |
13 | | * Unless required by applicable law or agreed to in writing, software |
14 | | * distributed under the License is distributed on an "AS IS" BASIS, |
15 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16 | | * See the License for the specific language governing permissions and |
17 | | * limitations under the License. |
18 | | */ |
19 | | |
20 | | |
21 | | #include <cprofiles/cprofiles.h> |
22 | | |
23 | | struct cprof_function *cprof_function_create(struct cprof_profile *profile) |
24 | 0 | { |
25 | 0 | struct cprof_function *instance; |
26 | |
|
27 | 0 | instance = calloc(1, sizeof(struct cprof_function)); |
28 | |
|
29 | 0 | if (instance == NULL) { |
30 | 0 | return NULL; |
31 | 0 | } |
32 | | |
33 | 0 | cfl_list_add(&instance->_head, &profile->functions); |
34 | |
|
35 | 0 | return instance; |
36 | 0 | } |
37 | | |
38 | | void cprof_function_destroy(struct cprof_function *instance) |
39 | 0 | { |
40 | 0 | if (instance != NULL) { |
41 | 0 | free(instance); |
42 | 0 | } |
43 | 0 | } |