From defd3ec220bf0ef01e82667fa93400b62e877b4e Mon Sep 17 00:00:00 2001 From: Sudeep Mohanty Date: Fri, 26 Jan 2024 15:20:19 +0100 Subject: [PATCH] fix(esp_ringbuf): Updated esp_ringbuf to follow astyle format This commit updates the esp_ringbuf component to follow astyle formatting. --- components/esp_ringbuf/include/freertos/ringbuf.h | 2 -- components/esp_ringbuf/ringbuf.c | 14 +++++++------- .../esp_ringbuf/test_apps/main/test_ringbuf.c | 8 ++++---- tools/ci/astyle-rules.yml | 1 - 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/components/esp_ringbuf/include/freertos/ringbuf.h b/components/esp_ringbuf/include/freertos/ringbuf.h index 79880ce311..dc176a233a 100644 --- a/components/esp_ringbuf/include/freertos/ringbuf.h +++ b/components/esp_ringbuf/include/freertos/ringbuf.h @@ -91,7 +91,6 @@ RingbufHandle_t xRingbufferCreate(size_t xBufferSize, RingbufferType_t xBufferTy */ RingbufHandle_t xRingbufferCreateNoSplit(size_t xItemSize, size_t xItemNum); - /** * @brief Create a ring buffer but manually provide the required memory * @@ -450,7 +449,6 @@ size_t xRingbufferGetCurFreeSize(RingbufHandle_t xRingbuffer); */ BaseType_t xRingbufferAddToQueueSetRead(RingbufHandle_t xRingbuffer, QueueSetHandle_t xQueueSet); - /** * @brief Check if the selected queue set member is a particular ring buffer * diff --git a/components/esp_ringbuf/ringbuf.c b/components/esp_ringbuf/ringbuf.c index 25b28abecc..18ff802a3c 100644 --- a/components/esp_ringbuf/ringbuf.c +++ b/components/esp_ringbuf/ringbuf.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -44,7 +44,7 @@ typedef struct { typedef struct RingbufferDefinition Ringbuffer_t; typedef BaseType_t (*CheckItemFitsFunction_t)(Ringbuffer_t *pxRingbuffer, size_t xItemSize); typedef void (*CopyItemFunction_t)(Ringbuffer_t *pxRingbuffer, const uint8_t *pcItem, size_t xItemSize); -typedef BaseType_t (*CheckItemAvailFunction_t) (Ringbuffer_t *pxRingbuffer); +typedef BaseType_t (*CheckItemAvailFunction_t)(Ringbuffer_t *pxRingbuffer); typedef void *(*GetItemFunction_t)(Ringbuffer_t *pxRingbuffer, BaseType_t *pxIsSplit, size_t xMaxSize, size_t *pxItemSize); typedef void (*ReturnItemFunction_t)(Ringbuffer_t *pxRingbuffer, uint8_t *pvItem); typedef size_t (*GetCurMaxSizeFunction_t)(Ringbuffer_t *pxRingbuffer); @@ -98,10 +98,10 @@ static size_t prvGetFreeSize(Ringbuffer_t *pxRingbuffer); static BaseType_t prvCheckItemAvail(Ringbuffer_t *pxRingbuffer); //Checks if an item will currently fit in a no-split/allow-split ring buffer -static BaseType_t prvCheckItemFitsDefault( Ringbuffer_t *pxRingbuffer, size_t xItemSize); +static BaseType_t prvCheckItemFitsDefault(Ringbuffer_t *pxRingbuffer, size_t xItemSize); //Checks if an item will currently fit in a byte buffer -static BaseType_t prvCheckItemFitsByteBuffer( Ringbuffer_t *pxRingbuffer, size_t xItemSize); +static BaseType_t prvCheckItemFitsByteBuffer(Ringbuffer_t *pxRingbuffer, size_t xItemSize); /* Copies an item to a no-split ring buffer @@ -276,7 +276,7 @@ static size_t prvGetFreeSize(Ringbuffer_t *pxRingbuffer) return xReturn; } -static BaseType_t prvCheckItemFitsDefault( Ringbuffer_t *pxRingbuffer, size_t xItemSize) +static BaseType_t prvCheckItemFitsDefault(Ringbuffer_t *pxRingbuffer, size_t xItemSize) { //Check arguments and buffer state configASSERT(rbCHECK_ALIGNED(pxRingbuffer->pucAcquire)); //pucAcquire is always aligned in no-split/allow-split ring buffers @@ -304,7 +304,7 @@ static BaseType_t prvCheckItemFitsDefault( Ringbuffer_t *pxRingbuffer, size_t xI } } -static BaseType_t prvCheckItemFitsByteBuffer( Ringbuffer_t *pxRingbuffer, size_t xItemSize) +static BaseType_t prvCheckItemFitsByteBuffer(Ringbuffer_t *pxRingbuffer, size_t xItemSize) { //Check arguments and buffer state configASSERT(pxRingbuffer->pucAcquire >= pxRingbuffer->pucHead && pxRingbuffer->pucAcquire < pxRingbuffer->pucTail); //Check acquire pointer is within bounds @@ -1246,7 +1246,7 @@ void vRingbufferDelete(RingbufHandle_t xRingbuffer) configASSERT(pxRingbuffer); //Ring buffer was not statically allocated. Free its memory. - if ( !( pxRingbuffer->uxRingbufferFlags & rbBUFFER_STATIC_FLAG ) ) { + if (!(pxRingbuffer->uxRingbufferFlags & rbBUFFER_STATIC_FLAG)) { free(pxRingbuffer->pucHead); free(pxRingbuffer); } diff --git a/components/esp_ringbuf/test_apps/main/test_ringbuf.c b/components/esp_ringbuf/test_apps/main/test_ringbuf.c index 6fcea7fbd5..7284b59f43 100644 --- a/components/esp_ringbuf/test_apps/main/test_ringbuf.c +++ b/components/esp_ringbuf/test_apps/main/test_ringbuf.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -650,7 +650,7 @@ static void queue_set_receiving_task(void *queue_set_handle) receive_check_and_return_item_byte_buffer(buffer_handles[2], small_item, SMALL_ITEM_SIZE, 0, false); items_rec_count[2] ++; } else { - TEST_ASSERT_MESSAGE( false, "Error with queue set member"); + TEST_ASSERT_MESSAGE(false, "Error with queue set member"); } //Check for completion @@ -1045,7 +1045,7 @@ static IRAM_ATTR __attribute__((noinline)) bool iram_ringbuf_test(void) TEST_CASE("Test ringbuffer functions work with flash cache disabled", "[esp_ringbuf]") { - TEST_ASSERT( iram_ringbuf_test() ); + TEST_ASSERT(iram_ringbuf_test()); } #endif /* !CONFIG_RINGBUF_PLACE_FUNCTIONS_INTO_FLASH && !CONFIG_RINGBUF_PLACE_ISR_FUNCTIONS_INTO_FLASH */ @@ -1111,7 +1111,7 @@ TEST_CASE("Test ringbuffer with caps", "[esp_ringbuf]") StaticRingbuffer_t *rb_obj; // Create ring buffer with caps - rb_handle = xRingbufferCreateWithCaps(BUFFER_SIZE, RINGBUF_TYPE_NOSPLIT, (MALLOC_CAP_INTERNAL|MALLOC_CAP_8BIT)); + rb_handle = xRingbufferCreateWithCaps(BUFFER_SIZE, RINGBUF_TYPE_NOSPLIT, (MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT)); TEST_ASSERT_NOT_EQUAL(NULL, rb_handle); // Get the ring buffer's memory diff --git a/tools/ci/astyle-rules.yml b/tools/ci/astyle-rules.yml index 5e14962656..72f8b3e4ba 100644 --- a/tools/ci/astyle-rules.yml +++ b/tools/ci/astyle-rules.yml @@ -70,7 +70,6 @@ components_not_formatted_temporary: - "/components/esp_partition/" - "/components/esp_phy/" - "/components/esp_pm/" - - "/components/esp_ringbuf/" - "/components/esp_rom/" - "/components/esp_system/" - "/components/esp_timer/"