Skip to content

Add configASSERT to queue metadata accessor functions - #1467

Open
wanghengZzz wants to merge 1 commit into
FreeRTOS:mainfrom
wanghengZzz:queue/assert
Open

Add configASSERT to queue metadata accessor functions#1467
wanghengZzz wants to merge 1 commit into
FreeRTOS:mainfrom
wanghengZzz:queue/assert

Conversation

@wanghengZzz

Copy link
Copy Markdown
Contributor

Description

Several queue.c accessor functions dereference xQueue without first
validating it with configASSERT, unlike comparable functions in the
same file (e.g. uxQueueMessagesWaiting(), uxQueueSpacesAvailable()).

This PR adds configASSERT( xQueue ) to:

  • uxQueueGetQueueNumber()
  • vQueueSetQueueNumber()
  • ucQueueGetQueueType()
  • uxQueueGetQueueItemSize()
  • uxQueueGetQueueLength()

This is a pure consistency fix with no behavioral change when
configASSERT is disabled (the default), and only adds a debug-time
check when configASSERT is enabled.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

uxQueueGetQueueNumber(), vQueueSetQueueNumber(), ucQueueGetQueueType(),
uxQueueGetQueueItemSize(), and uxQueueGetQueueLength() dereference the
queue handle without first checking that it is not NULL, unlike other
public queue accessors such as uxQueueMessagesWaiting() and
uxQueueSpacesAvailable(). This adds configASSERT( xQueue ) to each of
these functions for consistency and to catch invalid handles in debug
builds.
@sonarqubecloud

sonarqubecloud Bot commented Aug 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant