Skip to content

Commit

Permalink
change abort() -> ddsrt_abort in core
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Oetinger <[email protected]>
  • Loading branch information
poetinger committed Dec 13, 2023
1 parent 778fedb commit b9d2e79
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion ports/freertos-posix/src/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void vAssertCalled(unsigned long ulLine, const char * const pcFileName)
fprintf(stderr, "[ASSERT] %s:%lu"LF, pcFileName, ulLine);
}
taskEXIT_CRITICAL();
abort();
ddsrt_abort();
}

void vApplicationMallocFailedHook(void)
Expand Down
2 changes: 1 addition & 1 deletion src/core/ddsc/src/dds_entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ dds_return_t dds_return_loan (dds_entity_t entity, void **buf, int32_t bufsz)
// bufsz <= 0 is accepted because it allows one to write:
//
// if (dds_return_loan(rd, buf, dds_take(rd, buf, ...)) < 0)
// abort();
// ddsrt_abort();
//
// with abort only being called if there is a real problem.
//
Expand Down
6 changes: 3 additions & 3 deletions src/ddsrt/include/dds/ddsrt/heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ ddsrt_set_allocator(
*
* @param[in] size The size, in bytes, of the block of memory to allocate.
*
* @returns A pointer to the allocated block of memory. abort() is called if
* @returns A pointer to the allocated block of memory. ddsrt_abort() is called if
* not enough free memory was available.
*/
DDS_EXPORT void *
Expand Down Expand Up @@ -85,7 +85,7 @@ ddsrt_attribute_alloc_size((1));
* A non-NULL pointer, that must be freed is always returned, even if the sum
* @count and @size equals zero.
*
* @returns A pointer to the allocated memory. abort() is called if not enough
* @returns A pointer to the allocated memory. ddsrt_abort() is called if not enough
* free memory was available.
*/
DDS_EXPORT void *
Expand Down Expand Up @@ -123,7 +123,7 @@ ddsrt_attribute_alloc_size((1,2));
* pointed to by memblk and returns a pointer as if ddsrt_malloc_s(0) was
* invoked. The returned pointer must be free'd with ddsrt_free.
*
* @returns A pointer to reallocated memory. Calls abort() if not enough free
* @returns A pointer to reallocated memory. Calls ddsrt_abort() if not enough free
* memory was available.
*/
DDS_EXPORT void *
Expand Down
6 changes: 3 additions & 3 deletions src/ddsrt/src/heap/freertos/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void *ddsrt_malloc(size_t size)
void *ptr;

if ((ptr = ddsrt_malloc_s(size)) == NULL) {
abort();
ddsrt_abort();
}

return ptr;
Expand Down Expand Up @@ -80,7 +80,7 @@ void *ddsrt_calloc(size_t nmemb, size_t size)
void *ptr = NULL;

if ((ptr = ddsrt_calloc_s(nmemb, size)) == NULL) {
abort();
ddsrt_abort();
}

return ptr;
Expand Down Expand Up @@ -121,7 +121,7 @@ void *ddsrt_realloc(void *memblk, size_t size)
void *ptr = NULL;

if ((ptr = ddsrt_realloc_s(memblk, size)) == NULL) {
abort();
ddsrt_abort();
}

return ptr;
Expand Down
14 changes: 7 additions & 7 deletions src/ddsrt/src/sync/freertos/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ void ddsrt_mutex_init(ddsrt_mutex_t *mutex)
assert(mutex != NULL);

if ((sem = xSemaphoreCreateMutex()) == NULL) {
abort();
ddsrt_abort();
}

(void)memset(mutex, 0, sizeof(*mutex));
Expand Down Expand Up @@ -136,11 +136,11 @@ void ddsrt_cond_init(ddsrt_cond_t *cond)
assert(cond != NULL);

if (ddsrt_tasklist_init(&tasks) == -1) {
abort();
ddsrt_abort();
}
if ((sem = xSemaphoreCreateMutex()) == NULL) {
ddsrt_tasklist_fini(&tasks);
abort();
ddsrt_abort();
}

(void)memset(cond, 0, sizeof(*cond));
Expand Down Expand Up @@ -178,7 +178,7 @@ ddsrt_cond_waitfor(

switch ((rc = cond_timedwait(cond, mutex, reltime))) {
case DDS_RETCODE_OUT_OF_RESOURCES:
abort();
ddsrt_abort();
case DDS_RETCODE_TIMEOUT:
return false;
default:
Expand Down Expand Up @@ -207,7 +207,7 @@ ddsrt_cond_waituntil(

switch ((rc = cond_timedwait(cond, mutex, reltime))) {
case DDS_RETCODE_OUT_OF_RESOURCES:
abort();
ddsrt_abort();
case DDS_RETCODE_TIMEOUT:
return false;
default:
Expand Down Expand Up @@ -256,11 +256,11 @@ void ddsrt_rwlock_init(ddsrt_rwlock_t *rwlock)
assert(rwlock != NULL);

if (ddsrt_tasklist_init(&tasks) == -1) {
abort();
ddsrt_abort();
}
if ((sem = xSemaphoreCreateMutex()) == NULL) {
ddsrt_tasklist_fini(&tasks);
abort();
ddsrt_abort();
}

memset(rwlock, 0, sizeof(*rwlock));
Expand Down
4 changes: 2 additions & 2 deletions src/ddsrt/src/sync/windows/sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ ddsrt_cond_wait(ddsrt_cond_t *cond, ddsrt_mutex_t *mutex)
assert(mutex != NULL);

if (!SleepConditionVariableSRW(&cond->cond, &mutex->lock, INFINITE, 0)) {
abort();
ddsrt_abort();
}
}

Expand Down Expand Up @@ -108,7 +108,7 @@ ddsrt_cond_waitfor(
if (SleepConditionVariableSRW(&cond->cond, &mutex->lock, msecs, 0)) {
return true;
} else if (GetLastError() != ERROR_TIMEOUT) {
abort();
ddsrt_abort();
}

return (dds_time() >= abstime) ? false : true;
Expand Down
2 changes: 1 addition & 1 deletion src/ddsrt/src/threads/windows/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ void ddsrt_thread_init(uint32_t reason)
if (reason != DLL_PROCESS_ATTACH)
return;
if ((cleanup = TlsAlloc()) == TLS_OUT_OF_INDEXES)
abort();
ddsrt_abort();
}

void ddsrt_thread_fini(uint32_t reason)
Expand Down

0 comments on commit b9d2e79

Please sign in to comment.