spa: debug: log: use SPA_CONTAINER_OF()

Use `SPA_CONTAINER_OF()` instead of direct casting as it is
more resilient against future changes that might reorder the
members in `struct spa_debug_log_ctx`.
This commit is contained in:
Barnabás Pőcze 2023-11-05 04:12:30 +01:00
parent 6f6bf204d6
commit e4d1ab0c19

View file

@ -38,7 +38,7 @@ struct spa_debug_log_ctx {
SPA_PRINTF_FUNC(2,3)
static inline void spa_debug_log_log(struct spa_debug_context *ctx, const char *fmt, ...)
{
struct spa_debug_log_ctx *c = (struct spa_debug_log_ctx*)ctx;
struct spa_debug_log_ctx *c = SPA_CONTAINER_OF(ctx, struct spa_debug_log_ctx, ctx);
va_list args;
va_start(args, fmt);
spa_log_logtv(c->log, c->level, c->topic, c->file, c->line, c->func, fmt, args);