Skip to content

Add helper for "cleanup" variable attribute

Bastien Nocera linux-bluetooth 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest6 patches 6 repliesIn review
  2. v25 patches 2 repliesSuperseded
  3. v15 patches 1 replySuperseded

Changes in v3 from the cover letter

- Add macros to declare cleanup for specific types
- Add file descriptor cleanup
- Add "steal" helpers for fd and pointers
- Add unit tests

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6all: Remove more unneeded MIN/MAX macro definitionlib/bluetooth/hci.c src/main.c src/shared/gatt-server.c+0 -161 reply
2/6shared/util: Add helper for "cleanup" variable attributesrc/shared/util.h unit/test-util.c+105 -00 replies
3/6doc: Recommend using _cleanup_ and friendsdoc/maintainer-guidelines.rst+3 -00 replies
4/6main: Use _cleanup_() to simplify configuration parsingsrc/main.c+31 -701 reply
5/6client: Use _cleanup_fd_ to simplify urandom accessclient/mgmt.c+1 -40 replies
6/6btattach: Use _cleanup_fd_ to simplify error pathstools/btattach.c+6 -120 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [BlueZ v3 0/6] Add helper for "cleanup" variable attribute

As discussed in:
https://lore.kernel.org/linux-bluetooth/[email protected]/

Implement a cleanup helper.

The MIN/MAX fix is here because it touches the same hunk in src/main.c as the other patches. Feel free to pick it up straight away while the rest is discussed.

Changes since v2:
- Add macros to declare cleanup for specific types
- Add file descriptor cleanup
- Add "steal" helpers for fd and pointers
- Add unit tests

Changes since v1:
- Fixed checkpatch warnings

Bastien Nocera (6):
all: Remove more unneeded MIN/MAX macro definition shared/util: Add helper for "cleanup" variable attribute
doc: Recommend using _cleanup_ and friends
main: Use _cleanup_() to simplify configuration parsing
client: Use _cleanup_fd_ to simplify urandom access
btattach: Use _cleanup_fd_ to simplify error paths

 client/mgmt.c                 |   5 +-
 doc/maintainer-guidelines.rst |   3 +
 lib/bluetooth/hci.c           |   4 --
 src/main.c                    | 103 ++++++++++------------------------
 src/shared/gatt-server.c      |   8 ---
 src/shared/util.h             |  40 +++++++++++++
 tools/btattach.c              |  18 ++----
 unit/test-util.c              |  65 +++++++++++++++++++++
 8 files changed, 145 insertions(+), 101 deletions(-)
Signature · 1 line
2.54.0