Coverage Report

Created: 2025-07-12 06:36

/src/rtpproxy/libre/rtpp_re.c
Line
Count
Source (jump to first uncovered line)
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
3.70k
{
23
    /* Not implemented */
24
    /* nop() */
25
3.70k
}
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
7.41k
{
37
    /* Not implemented */
38
    /* nop() */
39
7.41k
}
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
94.7k
{
56
94.7k
    struct re_mem *pvt;
57
94.7k
    void *rp;
58
59
94.7k
    pvt = rtpp_rzmalloc(sizeof(*pvt) + size, offsetof(typeof(*pvt), rcnt));
60
94.7k
    if (pvt == NULL)
61
0
        return (NULL);
62
94.7k
    rp = (void *)pvt->data;
63
94.7k
    if (dh != NULL) {
64
47.8k
        CALL_SMETHOD(pvt->rcnt, attach, (rtpp_refcnt_dtor_t)dh, rp);
65
47.8k
    }
66
94.7k
    return (rp);
67
94.7k
}
68
69
110k
#define D2P(d) (struct re_mem *)((char *)(d) - offsetof(struct re_mem, data))
70
71
void *
72
mem_deref(void *data)
73
165k
{
74
165k
    if (data != NULL) {
75
102k
        struct re_mem *pvt = D2P(data);
76
102k
        RTPP_OBJ_DECREF(pvt);
77
102k
    }
78
165k
    return (NULL);
79
165k
}
80
81
void *
82
mem_ref(void *data)
83
7.96k
{
84
7.96k
    struct re_mem *pvt = D2P(data);
85
86
7.96k
    RTPP_OBJ_INCREF(pvt);
87
7.96k
    return (data);
88
7.96k
}