From 140995dcac79e7fafaae52f56a31cdf7f7074fde Mon Sep 17 00:00:00 2001 From: Fabrice Bellard Date: Fri, 22 Dec 2023 11:03:44 +0100 Subject: added container_of macro --- lib/quickjs/quickjs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/quickjs/quickjs.c') diff --git a/lib/quickjs/quickjs.c b/lib/quickjs/quickjs.c index 8f348e7e..a9e89211 100644 --- a/lib/quickjs/quickjs.c +++ b/lib/quickjs/quickjs.c @@ -4088,7 +4088,7 @@ void JS_FreeCString(JSContext *ctx, const char *ptr) if (!ptr) return; /* purposely removing constness */ - p = (JSString *)(void *)(ptr - offsetof(JSString, u)); + p = container_of(ptr, JSString, u); JS_FreeValue(ctx, JS_MKPTR(JS_TAG_STRING, p)); } -- cgit 1.4.1-2-gfad0