From: Ian Jackson Date: Tue, 24 Jan 2017 13:52:59 +0000 (+0000) Subject: cdb: Replace ad-hocery with use of offsetof/typeof. Closes:#812718. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl.git;a=commitdiff_plain;h=62f8f2f13b024b49dfbed2b2839ec510ad37eb85;ds=sidebyside cdb: Replace ad-hocery with use of offsetof/typeof. Closes:#812718. --- diff --git a/cdb/chiark_tcl_cdb.h b/cdb/chiark_tcl_cdb.h index fef668c..201b8f1 100644 --- a/cdb/chiark_tcl_cdb.h +++ b/cdb/chiark_tcl_cdb.h @@ -26,6 +26,7 @@ #include #include +#include #include diff --git a/cdb/writeable.c b/cdb/writeable.c index 6b072ff..3ad0c1e 100644 --- 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; } diff --git a/debian/changelog b/debian/changelog index 5931b0e..217cc5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,7 @@ chiark-tcl (1.1.4~~iwj) UNRELEASED; urgency=low be replaced with similar functionality elsewhere, but for now this change fixes the FTBFS on Debian hurd-* and kfreebsd-*. * Update build-dependencies to permit tcl8.6. Closes:#818475. + * Replace ad-hocery with use of offsetof/typeof. Closes:#812718. -- Ian Jackson Tue, 24 Jan 2017 13:14:06 +0000