micropython/extmod/nimble
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
..
bsp extmod/nimble: Add nimble bindings. 2019-10-01 09:51:02 +10:00
hal all: Fix spelling mistakes based on codespell check. 2023-04-27 18:03:06 +10:00
logcfg extmod/modbluetooth: Refactor stack/hci/driver/port bindings. 2020-09-08 11:41:31 +10:00
nimble extmod/nimble: Update to NimBLE v1.4. 2021-10-26 16:43:18 +11:00
syscfg extmod/modbluetooth: Allow configuration of pairing/bonding parameters. 2020-12-02 14:40:49 +11:00
modbluetooth_nimble.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
modbluetooth_nimble.h extmod/modbluetooth: Replace def_handle with end_handle in char IRQ. 2022-09-09 11:24:24 +10:00
nimble.cmake extmod/nimble: Add nimble CMake fragment file. 2021-09-19 23:02:16 +10:00
nimble.mk extmod: Make extmod.mk self-contained. 2022-10-11 23:31:49 +11:00