chiark / gitweb /
cdb: Replace ad-hocery with use of offsetof/typeof. Closes:#812718.
[chiark-tcl.git] / cdb / writeable.c
index 6b072ffdba7042398965758dc6ad386b18c15a5b..3ad0c1e5499ab01cc994e7d54dbf352299823595 100644 (file)
@@ -75,7 +75,7 @@ typedef struct HashValue {
 
 static HashValue *htv_prep(int len) {
   HashValue *hd;
-  hd= TALLOC((hd->data - (Byte*)hd) + len);
+  hd= TALLOC(offsetof(typeof(*hd), data) + len);
   hd->len= len;
   return hd;
 }