Coverage Report

Created: 2025-12-27 06:52

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wireshark/wsutil/wmem/wmem_miscutl.c
Line
Count
Source
1
/* wmem_miscutl.c
2
 * Wireshark Memory Manager Misc Utilities
3
 * Copyright 2013, Evan Huus <eapache@gmail.com>
4
 *
5
 * Wireshark - Network traffic analyzer
6
 * By Gerald Combs <gerald@wireshark.org>
7
 * Copyright 1998 Gerald Combs
8
 *
9
 * SPDX-License-Identifier: GPL-2.0-or-later
10
 */
11
12
#include <string.h>
13
#include <glib.h>
14
15
#include "wmem_core.h"
16
#include "wmem_miscutl.h"
17
18
void *
19
wmem_memdup(wmem_allocator_t *allocator, const void *source, const size_t size)
20
346k
{
21
346k
    void *dest;
22
23
346k
    if (!size)
24
26
        return NULL;
25
26
346k
    dest = wmem_alloc(allocator, size);
27
346k
    memcpy(dest, source, size);
28
29
346k
    return dest;
30
346k
}
31
32
int
33
wmem_compare_int(const void *a, const void *b)
34
0
{
35
0
    return GPOINTER_TO_INT(a) - GPOINTER_TO_INT(b);
36
0
}
37
38
int
39
wmem_compare_uint(const void *a, const void *b)
40
331k
{
41
331k
    return GPOINTER_TO_UINT(a) > GPOINTER_TO_UINT(b) ? 1 : (GPOINTER_TO_UINT(a) < GPOINTER_TO_UINT(b) ? -1 : 0);
42
331k
}
43
44
/*
45
 * Editor modelines  -  https://www.wireshark.org/tools/modelines.html
46
 *
47
 * Local variables:
48
 * c-basic-offset: 4
49
 * tab-width: 8
50
 * indent-tabs-mode: nil
51
 * End:
52
 *
53
 * vi: set shiftwidth=4 tabstop=8 expandtab:
54
 * :indentSize=4:tabSize=8:noTabs=true:
55
 */