diff options
author | midipix <writeonce@midipix.org> | 2016-09-02 14:33:57 -0400 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-09-03 14:36:36 -0400 |
commit | 3a8090030fad79d143daa3df00ee367d86ada75a (patch) | |
tree | 77bea0654e76ddca42545624d064be304b56708d /src | |
parent | 97a847ee367c8cae1805a5ed9c3021c9c83ed1ce (diff) | |
download | slibtool-3a8090030fad79d143daa3df00ee367d86ada75a.tar.bz2 slibtool-3a8090030fad79d143daa3df00ee367d86ada75a.tar.xz |
driver: internals: added the static inlined slbt_get_driver_ictx() helper.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/slibtool_driver_impl.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h index f79f9e3..19549ad 100644 --- a/src/internal/slibtool_driver_impl.h +++ b/src/internal/slibtool_driver_impl.h @@ -84,4 +84,16 @@ struct slbt_unit_ctx_impl { struct slbt_unit_ctx uctx; }; +static inline struct slbt_driver_ctx_impl * slbt_get_driver_ictx(const struct slbt_driver_ctx * dctx) +{ + uintptr_t addr; + + if (dctx) { + addr = (uintptr_t)dctx - offsetof(struct slbt_driver_ctx_impl,ctx); + return (struct slbt_driver_ctx_impl *)addr; + } + + return 0; +} + #endif |