Linux bluetooth development
 help / color / mirror / Atom feed
From: hadess <noreply@github.com>
To: linux-bluetooth@vger.kernel.org
Subject: [bluez/bluez] 61f18b: all: Remove more unneeded MIN/MAX macro definition
Date: Mon, 11 May 2026 09:17:43 -0700	[thread overview]
Message-ID: <bluez/bluez/push/refs/heads/1092801/000000-af87aa@github.com> (raw)

  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

                 reply	other threads:[~2026-05-11 16:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bluez/bluez/push/refs/heads/1092801/000000-af87aa@github.com \
    --to=noreply@github.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox