mirror of
https://gitlab.freedesktop.org/libinput/libei.git
synced 2026-02-04 02:30:25 +01:00
utils: add the etrace macro
Same as the existing trace but prints to stderr. And #include stdio so we can use this file as-is instead of needing extra includes. Part-of: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/351>
This commit is contained in:
parent
0831303a70
commit
297f95efac
1 changed files with 8 additions and 0 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include "config.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0])
|
||||
#define ARRAY_FOR_EACH(_arr, _elem) \
|
||||
|
|
@ -72,3 +73,10 @@
|
|||
snprintf(buf_, sizeof(buf_), __VA_ARGS__); \
|
||||
printf("\x1B[0;34m" "%s():%d - " "\x1B[0;31m" "%s" "\x1B[0m" "\n", __func__, __LINE__, buf_); \
|
||||
} while (0)
|
||||
|
||||
#define etrace(...) \
|
||||
do { \
|
||||
char buf_[1024]; \
|
||||
snprintf(buf_, sizeof(buf_), __VA_ARGS__); \
|
||||
fprintf(stderr, "\x1B[0;34m" "%s():%d - " "\x1B[0;31m" "%s" "\x1B[0m" "\n", __func__, __LINE__, buf_); \
|
||||
} while (0)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue