micropython/ports
Jim Mussared b6a9778484 py/misc: Change sizeof to offsetof for variable-length alloc.
This fixes the case where e.g.

    struct foo_t {
      mp_obj_t x;
      uint16_t y;
      char buf[];
    };

will have `sizeof(struct foo_t)==8`, but `offsetof(struct foo_t, buf)==6`.

When computing the size to allocate for `m_new_obj_var` we need to use
offsetof to avoid over-allocating. This is important especially when it
might cause it to spill over into another GC block.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-11-03 16:03:18 +11:00
..
bare-arm bare-arm/lib: Add minimal strncmp implementation. 2023-10-30 11:10:02 +11:00
cc3200 {cc3200,nrf}/boards/make-pins.py: Add a note about tools/boardgen.py. 2023-11-03 14:18:54 +11:00
embed
esp32 tools/boardgen.py: Add initial implementation of a common make-pins.py. 2023-11-03 14:06:27 +11:00
esp8266 ports: Remove SRC_QSTR_AUTO_DEPS from all ports' Makefiles. 2023-11-03 14:04:17 +11:00
mimxrt mimxrt/boards/make-pins.py: Update to use tools/boardgen.py. 2023-11-03 14:18:54 +11:00
minimal
nrf {cc3200,nrf}/boards/make-pins.py: Add a note about tools/boardgen.py. 2023-11-03 14:18:54 +11:00
pic16bit ports: Remove SRC_QSTR_AUTO_DEPS from all ports' Makefiles. 2023-11-03 14:04:17 +11:00
powerpc
qemu-arm extmod/modmachine: Consolidate mem, i2c and spi headers to modmachine.h. 2023-10-26 17:40:22 +11:00
renesas-ra renesas-ra/boards/make-pins.py: Update to use tools/boardgen.py. 2023-11-03 14:18:54 +11:00
rp2 tools/boardgen.py: Add initial implementation of a common make-pins.py. 2023-11-03 14:06:27 +11:00
samd samd/boards/make-pins.py: Update to use tools/boardgen.py. 2023-11-03 14:18:32 +11:00
stm32 stm32/boards/make-pins.py: Add initial support for H7 dual-pad pins. 2023-11-03 14:18:32 +11:00
unix py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
webassembly
windows ports: Remove SRC_QSTR_AUTO_DEPS from all ports' Makefiles. 2023-11-03 14:04:17 +11:00
zephyr extmod/modmachine: Consolidate mem, i2c and spi headers to modmachine.h. 2023-10-26 17:40:22 +11:00