Coverage Report

Created: 2026-06-20 07:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/fluent-bit/lib/cprofiles/cprof_resource.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_resource *cprof_resource_create(struct cfl_kvlist *attributes)
24
0
{
25
0
    struct cprof_resource *resource;
26
27
0
    resource = calloc(1, sizeof(struct cprof_resource));
28
29
0
    if (resource == NULL) {
30
0
        return NULL;
31
0
    }
32
33
0
    if (attributes == NULL) {
34
0
        resource->attributes = cfl_kvlist_create();
35
36
0
        if (resource->attributes == NULL) {
37
0
            free(resource);
38
39
0
            return NULL;
40
0
        }
41
0
    }
42
0
    else {
43
0
        resource->attributes = attributes;
44
0
    }
45
46
0
    return resource;
47
0
}
48
49
void cprof_resource_destroy(struct cprof_resource *resource)
50
0
{
51
0
    if (resource->attributes != NULL) {
52
0
        cfl_kvlist_destroy(resource->attributes);
53
0
    }
54
55
0
    free(resource);
56
0
}
57
58
int cprof_resource_profiles_add(struct cprof *context,
59
                                struct cprof_resource_profiles *resource_profiles)
60
0
{
61
0
    cfl_list_add(&resource_profiles->_head, &context->profiles);
62
63
0
    return 0;
64
0
}