Skip to content

Commit 457fbad

Browse files
author
Cruz Monrreal
authored
Merge pull request #10145 from kjbracey-arm/rtos_tidy
RTOS API: minor tidies
2 parents 775a91d + b7171d1 commit 457fbad

File tree

7 files changed

+2
-9
lines changed

7 files changed

+2
-9
lines changed

rtos/EventFlags.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ EventFlags::EventFlags(const char *name)
3838

3939
void EventFlags::constructor(const char *name)
4040
{
41-
memset(&_obj_mem, 0, sizeof(_obj_mem));
42-
osEventFlagsAttr_t attr;
41+
osEventFlagsAttr_t attr = { 0 };
4342
attr.name = name ? name : "application_unnamed_event_flags";
4443
attr.cb_mem = &_obj_mem;
4544
attr.cb_size = sizeof(_obj_mem);

rtos/MemoryPool.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
5757
MemoryPool()
5858
{
5959
memset(_pool_mem, 0, sizeof(_pool_mem));
60-
memset(&_obj_mem, 0, sizeof(_obj_mem));
6160
osMemoryPoolAttr_t attr = { 0 };
6261
attr.mp_mem = _pool_mem;
6362
attr.mp_size = sizeof(_pool_mem);

rtos/Mutex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ Mutex::Mutex(const char *name)
4040

4141
void Mutex::constructor(const char *name)
4242
{
43-
memset(&_obj_mem, 0, sizeof(_obj_mem));
4443
osMutexAttr_t attr =
4544
{ 0 };
4645
attr.name = name ? name : "aplication_unnamed_mutex";

rtos/Queue.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
6565
*/
6666
Queue()
6767
{
68-
memset(&_obj_mem, 0, sizeof(_obj_mem));
6968
osMessageQueueAttr_t attr = { 0 };
7069
attr.mq_mem = _queue_mem;
7170
attr.mq_size = sizeof(_queue_mem);

rtos/RtosTimer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,10 @@ namespace rtos {
3131
void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type)
3232
{
3333
_function = func;
34-
memset(&_obj_mem, 0, sizeof(_obj_mem));
3534
osTimerAttr_t attr = { 0 };
3635
attr.cb_mem = &_obj_mem;
3736
attr.cb_size = sizeof(_obj_mem);
38-
_id = osTimerNew((void (*)(void *))mbed::Callback<void()>::thunk, type, &_function, &attr);
37+
_id = osTimerNew(mbed::Callback<void()>::thunk, type, &_function, &attr);
3938
MBED_ASSERT(_id);
4039
}
4140

rtos/Semaphore.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ Semaphore::Semaphore(int32_t count, uint16_t max_count)
3939

4040
void Semaphore::constructor(int32_t count, uint16_t max_count)
4141
{
42-
memset(&_obj_mem, 0, sizeof(_obj_mem));
4342
osSemaphoreAttr_t attr = { 0 };
4443
attr.cb_mem = &_obj_mem;
4544
attr.cb_size = sizeof(_obj_mem);

rtos/Thread.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ void Thread::constructor(uint32_t tz_module, osPriority priority,
5252
_tid = 0;
5353
_dynamic_stack = (stack_mem == NULL);
5454
_finished = false;
55-
memset(&_obj_mem, 0, sizeof(_obj_mem));
5655
memset(&_attr, 0, sizeof(_attr));
5756
_attr.priority = priority;
5857
_attr.stack_size = aligned_size;

0 commit comments

Comments
 (0)