summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/nxt_unit_sptr.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nxt_unit_sptr.h b/src/nxt_unit_sptr.h
index 314416e4..6d867a5e 100644
--- a/src/nxt_unit_sptr.h
+++ b/src/nxt_unit_sptr.h
@@ -24,7 +24,10 @@ union nxt_unit_sptr_u {
static inline void
nxt_unit_sptr_set(nxt_unit_sptr_t *sptr, void *ptr)
{
- sptr->offset = (uint8_t *) ptr - sptr->base;
+ const uint8_t *base;
+
+ base = sptr->base;
+ sptr->offset = (uint8_t *) ptr - base;
}