Linux bluetooth development
 help / color / mirror / Atom feed
* [bluez/bluez] 61f18b: all: Remove more unneeded MIN/MAX macro definition
@ 2026-05-11 16:17 hadess
  0 siblings, 0 replies; only message in thread
From: hadess @ 2026-05-11 16:17 UTC (permalink / raw)
  To: linux-bluetooth

  Branch: refs/heads/1092801
  Home:   https://github.com/bluez/bluez
  Commit: 61f18ba7be36b9be5ab6dcdde0384342c13a3074
      https://github.com/bluez/bluez/commit/61f18ba7be36b9be5ab6dcdde0384342c13a3074
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M lib/bluetooth/hci.c
    M src/main.c
    M src/shared/gatt-server.c

  Log Message:
  -----------
  all: Remove more unneeded MIN/MAX macro definition


  Commit: 98ed10e18895daeb15710d710a0803f6115c20f2
      https://github.com/bluez/bluez/commit/98ed10e18895daeb15710d710a0803f6115c20f2
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M src/shared/util.h
    M unit/test-util.c

  Log Message:
  -----------
  shared/util: Add helper for "cleanup" variable attribute

Use the widespread "cleanup" variable attribute:
https://gcc.gnu.org/onlinedocs/gcc/Common-Attributes.html#index-cleanup

It is implemented by both GCC and clang on platforms where bluez is
used, and can help reduce memory leaks, while improving readability.

This implements:
- generic cleanup (_cleanup_free_)
- cleanup with specific free function (_cleanup_())
- cleanup for specific types (_cleanup_type_(type))
- cleanup for file descriptors
- capturing a variable before it is freed (so it is only freed in error
  paths for example, _steal_() and _steal_fd())

This commit includes tests which should cover all those new helpers.

See also:
https://systemd.io/CODING_STYLE/#memory-allocation
https://docs.gtk.org/glib/auto-cleanup.html


  Commit: efd84a04d454729f63e8d1066d9dc3b43065d395
      https://github.com/bluez/bluez/commit/efd84a04d454729f63e8d1066d9dc3b43065d395
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M doc/maintainer-guidelines.rst

  Log Message:
  -----------
  doc: Recommend using _cleanup_ and friends


  Commit: af36f1586544499ac5d4fa267283ea58bdaed9e7
      https://github.com/bluez/bluez/commit/af36f1586544499ac5d4fa267283ea58bdaed9e7
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M src/main.c

  Log Message:
  -----------
  main: Use _cleanup_() to simplify configuration parsing

Use helpers to simplify temporary string usage, and cleanup in error
paths.


  Commit: 6c98d5b5189da2de46d50c8cc7f9bee0ae56c259
      https://github.com/bluez/bluez/commit/6c98d5b5189da2de46d50c8cc7f9bee0ae56c259
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M client/mgmt.c

  Log Message:
  -----------
  client: Use _cleanup_fd_ to simplify urandom access

fd gets auto-closed before exiting the scope.


  Commit: af87aaabc6926eb294244ab8da514bc4b221b344
      https://github.com/bluez/bluez/commit/af87aaabc6926eb294244ab8da514bc4b221b344
  Author: Bastien Nocera <hadess@hadess.net>
  Date:   2026-05-11 (Mon, 11 May 2026)

  Changed paths:
    M tools/btattach.c

  Log Message:
  -----------
  btattach: Use _cleanup_fd_ to simplify error paths

Use _cleanup_fd_ and _steal_fd() to simplify error paths, and only
"steal" the file descriptor on success.


Compare: https://github.com/bluez/bluez/compare/61f18ba7be36%5E...af87aaabc692

To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-11 16:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 16:17 [bluez/bluez] 61f18b: all: Remove more unneeded MIN/MAX macro definition hadess

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox