Skip to content

RTOS API: minor tidies #10145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions rtos/EventFlags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ EventFlags::EventFlags(const char *name)

void EventFlags::constructor(const char *name)
{
memset(&_obj_mem, 0, sizeof(_obj_mem));
osEventFlagsAttr_t attr;
osEventFlagsAttr_t attr = { 0 };
attr.name = name ? name : "application_unnamed_event_flags";
attr.cb_mem = &_obj_mem;
attr.cb_size = sizeof(_obj_mem);
Expand Down
1 change: 0 additions & 1 deletion rtos/MemoryPool.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class MemoryPool : private mbed::NonCopyable<MemoryPool<T, pool_sz> > {
MemoryPool()
{
memset(_pool_mem, 0, sizeof(_pool_mem));
memset(&_obj_mem, 0, sizeof(_obj_mem));
osMemoryPoolAttr_t attr = { 0 };
attr.mp_mem = _pool_mem;
attr.mp_size = sizeof(_pool_mem);
Expand Down
1 change: 0 additions & 1 deletion rtos/Mutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Mutex::Mutex(const char *name)

void Mutex::constructor(const char *name)
{
memset(&_obj_mem, 0, sizeof(_obj_mem));
osMutexAttr_t attr =
{ 0 };
attr.name = name ? name : "aplication_unnamed_mutex";
Expand Down
1 change: 0 additions & 1 deletion rtos/Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class Queue : private mbed::NonCopyable<Queue<T, queue_sz> > {
*/
Queue()
{
memset(&_obj_mem, 0, sizeof(_obj_mem));
osMessageQueueAttr_t attr = { 0 };
attr.mq_mem = _queue_mem;
attr.mq_size = sizeof(_queue_mem);
Expand Down
3 changes: 1 addition & 2 deletions rtos/RtosTimer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ namespace rtos {
void RtosTimer::constructor(mbed::Callback<void()> func, os_timer_type type)
{
_function = func;
memset(&_obj_mem, 0, sizeof(_obj_mem));
osTimerAttr_t attr = { 0 };
attr.cb_mem = &_obj_mem;
attr.cb_size = sizeof(_obj_mem);
_id = osTimerNew((void (*)(void *))mbed::Callback<void()>::thunk, type, &_function, &attr);
_id = osTimerNew(mbed::Callback<void()>::thunk, type, &_function, &attr);
MBED_ASSERT(_id);
}

Expand Down
1 change: 0 additions & 1 deletion rtos/Semaphore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ Semaphore::Semaphore(int32_t count, uint16_t max_count)

void Semaphore::constructor(int32_t count, uint16_t max_count)
{
memset(&_obj_mem, 0, sizeof(_obj_mem));
osSemaphoreAttr_t attr = { 0 };
attr.cb_mem = &_obj_mem;
attr.cb_size = sizeof(_obj_mem);
Expand Down
1 change: 0 additions & 1 deletion rtos/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ void Thread::constructor(uint32_t tz_module, osPriority priority,
_tid = 0;
_dynamic_stack = (stack_mem == NULL);
_finished = false;
memset(&_obj_mem, 0, sizeof(_obj_mem));
memset(&_attr, 0, sizeof(_attr));
_attr.priority = priority;
_attr.stack_size = aligned_size;
Expand Down