From 9b8e640378356775d25e39259c8feda7132162b7 Mon Sep 17 00:00:00 2001 From: midipix Date: Thu, 7 Jul 2016 01:44:58 -0400 Subject: ptyc_driver_ctx_impl(): implementation and integration (static, inline). --- src/internal/ptycon_driver_impl.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/internal') diff --git a/src/internal/ptycon_driver_impl.h b/src/internal/ptycon_driver_impl.h index a51c5a1..c46e146 100644 --- a/src/internal/ptycon_driver_impl.h +++ b/src/internal/ptycon_driver_impl.h @@ -31,4 +31,16 @@ struct ptyc_driver_ctx_impl { struct ptyc_driver_ctx ctx; }; +static inline struct ptyc_driver_ctx_impl * ptyc_get_driver_ictx(struct ptyc_driver_ctx * dctx) +{ + uintptr_t addr; + + if (dctx) { + addr = (uintptr_t)dctx - offsetof(struct ptyc_driver_ctx_impl,ctx); + return (struct ptyc_driver_ctx_impl *)addr; + } + + return 0; +} + #endif -- cgit v1.2.3