summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-08 06:30:24 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-08 06:30:24 -0700
commit21c445fd82fe7b3da332fcd89084807de3d41645 (patch)
treee3f6685d0b533e2a1a0fe604d913f3d3f52d0be9
parent50c5c92d6103d8dfc8d2382fae991daa7749f159 (diff)
downloadtxr-21c445fd82fe7b3da332fcd89084807de3d41645.tar.gz
txr-21c445fd82fe7b3da332fcd89084807de3d41645.tar.bz2
txr-21c445fd82fe7b3da332fcd89084807de3d41645.zip
ffi: don't zero out anonymous struct padding.
* ffi.c (ffi_struct_put, ffi_struct_out): Just skip the space corresponding to the anonymous padding member; don't memset with zeros. Doing this is inconsistent because we are not zero-filling the ordinary alignment padding between members and at the end of the struct. If the uninitialized garbage is a problem in some uses, we can provide a variation of the struct type which is zero initialized.
-rw-r--r--ffi.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/ffi.c b/ffi.c
index 6c831246..131801f3 100644
--- a/ffi.c
+++ b/ffi.c
@@ -929,8 +929,6 @@ static void ffi_struct_put(struct txr_ffi_type *tft, val strct, mem_t *dst,
if (slsym) {
val slval = slot(strct, slsym);
mtft->put(mtft, slval, dst + offs, self);
- } else {
- memset(dst + offs, 0, mtft->size);
}
offs += mtft->size;
}
@@ -957,8 +955,6 @@ static void ffi_struct_out(struct txr_ffi_type *tft, int copy, val strct,
val slval = slot(strct, slsym);
mtft->put(mtft, slval, dst + offs, self);
}
- } else if (copy) {
- memset(dst + offs, 0, mtft->size);
}
offs += mtft->size;
}