chiark
/
gitweb
/
~ian
/
chiark-tcl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
cdb: Replace ad-hocery with use of offsetof/typeof. Closes:#812718.
[chiark-tcl.git]
/
cdb
/
writeable.c
diff --git
a/cdb/writeable.c
b/cdb/writeable.c
index 6b072ffdba7042398965758dc6ad386b18c15a5b..3ad0c1e5499ab01cc994e7d54dbf352299823595 100644
(file)
--- a/
cdb/writeable.c
+++ b/
cdb/writeable.c
@@
-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;
}