Coverage Report

Created: 2025-10-13 07:10

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rtpproxy/libre/rtpp_re.c
Line
Count
Source
1
#include <stddef.h>
2
#include <stdint.h>
3
#include <stdlib.h>
4
#include <stdbool.h>
5
6
#include "rtpp_types.h"
7
#include "rtpp_mallocs.h"
8
#include "rtpp_codeptr.h"
9
#include "rtpp_refcnt.h"
10
11
struct ice_candpair;
12
struct tcp_conn;
13
struct sa;
14
struct udp_sock;
15
struct mbuf;
16
struct tmr;
17
18
typedef void (mem_destroy_h)(void *data);
19
20
void
21
tmr_init(struct tmr *tmr)
22
4.81k
{
23
    /* Not implemented */
24
    /* nop() */
25
4.81k
}
26
27
uint64_t
28
tmr_jiffies(void)
29
0
{
30
    /* Not implemented */
31
0
    return 0;
32
0
}
33
34
void
35
tmr_cancel(struct tmr *tmr)
36
8.51k
{
37
    /* Not implemented */
38
    /* nop() */
39
8.51k
}
40
41
void *
42
mem_realloc(void *data, size_t size)
43
0
{
44
    /* Not implemented */
45
0
    abort();
46
0
}
47
48
struct re_mem {
49
    struct rtpp_refcnt *rcnt;
50
    long long data[0];
51
};
52
53
void *
54
mem_zalloc(size_t size, mem_destroy_h *dh)
55
47.9k
{
56
47.9k
    struct re_mem *pvt;
57
47.9k
    void *rp;
58
59
47.9k
    pvt = rtpp_rzmalloc(sizeof(*pvt) + size, offsetof(typeof(*pvt), rcnt));
60
47.9k
    if (pvt == NULL)
61
0
        return (NULL);
62
47.9k
    rp = (void *)pvt->data;
63
47.9k
    if (dh != NULL) {
64
14.0k
        CALL_SMETHOD(pvt->rcnt, attach, (rtpp_refcnt_dtor_t)dh, rp);
65
14.0k
    }
66
47.9k
    return (rp);
67
47.9k
}
68
69
55.3k
#define D2P(d) (struct re_mem *)((char *)(d) - offsetof(struct re_mem, data))
70
71
void *
72
mem_deref(void *data)
73
92.0k
{
74
92.0k
    if (data != NULL) {
75
51.6k
        struct re_mem *pvt = D2P(data);
76
51.6k
        RTPP_OBJ_DECREF(pvt);
77
51.6k
    }
78
92.0k
    return (NULL);
79
92.0k
}
80
81
void *
82
mem_ref(void *data)
83
3.70k
{
84
3.70k
    struct re_mem *pvt = D2P(data);
85
86
3.70k
    RTPP_OBJ_INCREF(pvt);
87
3.70k
    return (data);
88
3.70k
}