diff --git a/modules/libcom/src/misc/cantProceed.c b/modules/libcom/src/misc/cantProceed.c index 80e26f8f6..47b928da3 100644 --- a/modules/libcom/src/misc/cantProceed.c +++ b/modules/libcom/src/misc/cantProceed.c @@ -24,7 +24,7 @@ LIBCOM_API void * callocMustSucceed(size_t count, size_t size, const char *msg) void * mem = NULL; if (count > 0 && size > 0) { while ((mem = calloc(count, size)) == NULL) { - errlogPrintf("%s: callocMustSucceed(%lu, %lu) - calloc failed\n", + errlogPrintf("%s: callocMustSucceed(%lu, %lu) - " ERL_ERROR " calloc failed\n", msg, (unsigned long)count, (unsigned long)size); errlogPrintf("Thread %s (%p) suspending.\n", epicsThreadGetNameSelf(), (void *)epicsThreadGetIdSelf()); @@ -40,7 +40,7 @@ LIBCOM_API void * mallocMustSucceed(size_t size, const char *msg) void * mem = NULL; if (size > 0) { while ((mem = malloc(size)) == NULL) { - errlogPrintf("%s: mallocMustSucceed(%lu) - malloc failed\n", + errlogPrintf("%s: mallocMustSucceed(%lu) - " ERL_ERROR " malloc failed\n", msg, (unsigned long)size); errlogPrintf("Thread %s (%p) suspending.\n", epicsThreadGetNameSelf(), (void *)epicsThreadGetIdSelf()); diff --git a/modules/libcom/src/misc/cantProceed.h b/modules/libcom/src/misc/cantProceed.h index 0232a8611..f9559b14c 100644 --- a/modules/libcom/src/misc/cantProceed.h +++ b/modules/libcom/src/misc/cantProceed.h @@ -56,18 +56,24 @@ LIBCOM_API void cantProceed( * gracefully when memory runs out. */ /** @{ */ -/** \brief A calloc() that never returns NULL. +/** \brief A calloc() which suspends on error. * \param count Number of objects. * \param size Size of each object. - * \param errorMessage What this memory is needed for. - * \return Pointer to zeroed allocated memory. + * \param errorMessage Context added to logged error message + * \return Pointer to zeroed allocated memory. Should later be free() d + * + * Will always return NULL for a zero length allocation. + * Will never return NULL otherwise. */ LIBCOM_API void * callocMustSucceed(size_t count, size_t size, const char *errorMessage); -/** \brief A malloc() that never returns NULL. +/** \brief A malloc() which suspends on error. * \param size Size of block to allocate. - * \param errorMessage What this memory is needed for. - * \return Pointer to allocated memory. + * \param errorMessage Context added to logged error message + * \return Pointer to allocated memory. Should later be free() d + * + * Will always return NULL for a zero length allocation. + * Will never return NULL otherwise. */ LIBCOM_API void * mallocMustSucceed(size_t size, const char *errorMessage); /** @} */