-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Python] Drop unnecessary null termination #33915
[Python] Drop unnecessary null termination #33915
Conversation
The ctypes data type `c_char_p` takes care of null-terminating the byte array provided to it. The additional null termination doesn't hurt in practice, but it's unnecessary.
This StackOverflow comment mentions that the implicitly called z_set function calls PyBytes_AsString which takes care of null termination, from the
I've verified this to be the case by checking what is present at memory address Additionally, we do have places where "manual" null-termination hasn't been applied, and it seemd to have worked too. |
PR #33915: Size comparison from a3bb9c3 to b2f627a Full report (85 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, mbed, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
This adds more cleanups from the master branch to keep our 1.3 based branch close to upstream. Most noteworthy here are a patch which stops mDNS discovery when using the on-network commissioning API, fixes when commissioning using WiFi/Thread setup through BLE directly (the Python Matter Server isn't using this APIs currently), dropping unnecessary code and and general messaging cleanup. Specifically, this integrates changes from the following PRs - project-chip/connectedhomeip#33882 - project-chip/connectedhomeip#33896 - project-chip/connectedhomeip#33891 - project-chip/connectedhomeip#33880 - project-chip/connectedhomeip#33914 - project-chip/connectedhomeip#33915 - project-chip/connectedhomeip#33933
The ctypes data type
c_char_p
takes care of null-terminating the byte array provided to it. The additional null termination doesn't hurt in practice, but it's unnecessary.