chiark / gitweb /
cdb: Replace ad-hocery with use of offsetof/typeof. Closes:#812718.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 24 Jan 2017 13:52:59 +0000 (13:52 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 24 Jan 2017 13:53:02 +0000 (13:53 +0000)
cdb/chiark_tcl_cdb.h
cdb/writeable.c
debian/changelog

index fef668c6efeede8127ac150ae7daea21226bc836..201b8f1feba9eff904a0dc0e7f7e4ce98d267ea1 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <ctype.h>
 #include <stdio.h>
+#include <stddef.h>
 
 #include <cdb.h>
 
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;
 }  
index 5931b0ee3176456aa2802d47d1ce78383348e666..217cc5a06c6a49c3b37576fb57be5bab30600417 100644 (file)
@@ -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 <ijackson@chiark.greenend.org.uk>  Tue, 24 Jan 2017 13:14:06 +0000