US_ONCE macro

This commit is contained in:
Maxim Devaev
2022-11-19 00:25:21 +03:00
parent 839804b476
commit 7335a5d2df
2 changed files with 18 additions and 17 deletions

View File

@@ -36,3 +36,11 @@
JANUS_LOG(LOG_ERR, "[%s/%-9s] " x_msg ": %s\n", US_PLUGIN_NAME, x_prefix, ##__VA_ARGS__, m_perror_str); \
free(m_perror_str); \
}
#define US_ONCE(...) { \
const unsigned m_reported = __LINE__; \
if (m_reported != once) { \
__VA_ARGS__; \
once = m_reported; \
} \
}