PipeWire
1.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
mem.h
Go to the documentation of this file.
1
/* Simple Plugin API */
2
/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
3
/* SPDX-License-Identifier: MIT */
4
5
#ifndef SPA_DEBUG_MEM_H
6
#define SPA_DEBUG_MEM_H
7
8
#include <inttypes.h>
9
10
#include <
spa/debug/context.h
>
11
#include <
spa/utils/string.h
>
12
13
#ifdef __cplusplus
14
extern
"C"
{
15
#endif
16
21
22
#ifndef SPA_API_DEBUG_MEM
23
#ifdef SPA_API_IMPL
24
#define SPA_API_DEBUG_MEM SPA_API_IMPL
25
#else
26
#define SPA_API_DEBUG_MEM static inline
27
#endif
28
#endif
29
30
SPA_API_DEBUG_MEM
int
spa_debugc_mem
(
struct
spa_debug_context
*ctx,
int
indent,
const
void
*data,
size_t
size)
31
{
32
const
uint8_t *t = (
const
uint8_t*)data;
33
char
buffer[512];
34
struct
spa_strbuf
b;
35
size_t
i;
36
37
for
(i = 0; i < size; i++) {
38
if
(i % 16 == 0) {
39
spa_strbuf_init
(&b, buffer,
sizeof
(buffer));
40
spa_strbuf_append
(&b,
"%p: "
, &t[i]);
41
}
42
spa_strbuf_append
(&b,
"%02x "
, t[i]);
43
if
(i % 16 == 15 || i == size - 1) {
44
spa_debugc
(ctx,
"%*s"
"%s"
, indent,
""
, buffer);
45
}
46
}
47
return
0;
48
}
49
50
SPA_API_DEBUG_MEM
int
spa_debug_mem
(
int
indent,
const
void
*data,
size_t
size)
51
{
52
return
spa_debugc_mem
(NULL, indent, data, size);
53
}
56
57
58
#ifdef __cplusplus
59
}
/* extern "C" */
60
#endif
61
62
#endif
/* SPA_DEBUG_MEM_H */
spa_debugc_mem
SPA_API_DEBUG_MEM int spa_debugc_mem(struct spa_debug_context *ctx, int indent, const void *data, size_t size)
Definition
mem.h:37
spa_debugc
#define spa_debugc(_c, _fmt,...)
Definition
context.h:50
spa_debug_mem
SPA_API_DEBUG_MEM int spa_debug_mem(int indent, const void *data, size_t size)
Definition
mem.h:57
SPA_API_DEBUG_MEM
#define SPA_API_DEBUG_MEM
Definition
mem.h:33
spa_strbuf_append
SPA_API_STRING int spa_strbuf_append(struct spa_strbuf *buf, const char *fmt,...)
Definition
string.h:401
spa_strbuf_init
SPA_API_STRING void spa_strbuf_init(struct spa_strbuf *buf, char *buffer, size_t maxsize)
Definition
string.h:381
context.h
spa/debug/context.h
string.h
spa/utils/string.h
spa_debug_context
Definition
context.h:46
spa_strbuf
Definition
string.h:375
spa
debug
mem.h
Generated by
1.18.0