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
hal
logcfg
nimble
syscfg
modbluetooth_nimble.c py/misc: Change sizeof to offsetof for variable-length alloc. 2023-11-03 16:03:18 +11:00
modbluetooth_nimble.h
nimble.cmake
nimble.mk