mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-05-14 14:18:09 +02:00
trace: Add a max size for the key
Not sure we'll ever hit this, but since we're concatenating strings into a static sized buffer I suppose it's useful to ensure it won't have an unreadable result. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
This commit is contained in:
parent
d8e6906563
commit
e1200eec22
1 changed files with 4 additions and 0 deletions
|
|
@ -33,6 +33,9 @@
|
|||
/* maximum allowed debug annotations */
|
||||
#define WESTON_MAX_DEBUG_ANNOTS 128
|
||||
|
||||
/* maximum key length */
|
||||
#define WESTON_TRACE_MAX_KEY_LENGTH 30
|
||||
|
||||
/* note that util_perfetto_is_tracing_enabled always returns false until
|
||||
* util_perfetto_init is called
|
||||
*/
|
||||
|
|
@ -83,6 +86,7 @@
|
|||
|
||||
#define _WESTON_TRACE_ANNOTATE_ADD_GENERIC(k, v) \
|
||||
if (unlikely(util_perfetto_is_tracing_enabled())) { \
|
||||
static_assert(sizeof(k) < WESTON_TRACE_MAX_KEY_LENGTH); \
|
||||
_Generic((v), \
|
||||
int: perfetto_annotate_int, \
|
||||
unsigned int: perfetto_annotate_int, \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue