summaryrefslogtreecommitdiffhomepage
path: root/src/internal/slibtool_driver_impl.h
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-09-02 14:33:57 -0400
committermidipix <writeonce@midipix.org>2016-09-03 14:36:36 -0400
commit3a8090030fad79d143daa3df00ee367d86ada75a (patch)
tree77bea0654e76ddca42545624d064be304b56708d /src/internal/slibtool_driver_impl.h
parent97a847ee367c8cae1805a5ed9c3021c9c83ed1ce (diff)
downloadslibtool-3a8090030fad79d143daa3df00ee367d86ada75a.tar.bz2
slibtool-3a8090030fad79d143daa3df00ee367d86ada75a.tar.xz
driver: internals: added the static inlined slbt_get_driver_ictx() helper.
Diffstat (limited to 'src/internal/slibtool_driver_impl.h')
-rw-r--r--src/internal/slibtool_driver_impl.h12
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