[qnx] handle broken cfree and mallopt

This commit is contained in:
Aliaksey Kandratsenka 2023-10-30 19:47:02 -04:00
parent 717bf724a5
commit d1a0cbe1bf
2 changed files with 10 additions and 0 deletions

View File

@ -284,6 +284,7 @@ AC_CHECK_DECLS([cfree,
valloc, valloc,
pvalloc],,, pvalloc],,,
[#define _XOPEN_SOURCE 600 [#define _XOPEN_SOURCE 600
#define _QNX_SOURCE 1
#include <stdlib.h> #include <stdlib.h>
#include <malloc.h>]) #include <malloc.h>])

View File

@ -212,7 +212,12 @@ extern "C" {
void free(void* ptr) __THROW ALIAS(tc_free); void free(void* ptr) __THROW ALIAS(tc_free);
void* realloc(void* ptr, size_t size) __THROW ALIAS(tc_realloc); void* realloc(void* ptr, size_t size) __THROW ALIAS(tc_realloc);
void* calloc(size_t n, size_t size) __THROW ALIAS(tc_calloc); void* calloc(size_t n, size_t size) __THROW ALIAS(tc_calloc);
#if __QNXNTO__
// QNX has crazy cfree declaration
int cfree(void* ptr) { tc_cfree(ptr); return 0; }
#else
void cfree(void* ptr) __THROW ALIAS(tc_cfree); void cfree(void* ptr) __THROW ALIAS(tc_cfree);
#endif
void* memalign(size_t align, size_t s) __THROW ALIAS(tc_memalign); void* memalign(size_t align, size_t s) __THROW ALIAS(tc_memalign);
void* aligned_alloc(size_t align, size_t s) __THROW ALIAS(tc_memalign); void* aligned_alloc(size_t align, size_t s) __THROW ALIAS(tc_memalign);
void* valloc(size_t size) __THROW ALIAS(tc_valloc); void* valloc(size_t size) __THROW ALIAS(tc_valloc);
@ -222,7 +227,11 @@ extern "C" {
#ifndef __UCLIBC__ #ifndef __UCLIBC__
void malloc_stats(void) __THROW ALIAS(tc_malloc_stats); void malloc_stats(void) __THROW ALIAS(tc_malloc_stats);
#endif #endif
#if __QNXNTO__
int mallopt(int, intptr_t) ALIAS(tc_mallopt);
#else
int mallopt(int cmd, int value) __THROW ALIAS(tc_mallopt); int mallopt(int cmd, int value) __THROW ALIAS(tc_mallopt);
#endif
#ifdef HAVE_STRUCT_MALLINFO #ifdef HAVE_STRUCT_MALLINFO
struct mallinfo mallinfo(void) __THROW ALIAS(tc_mallinfo); struct mallinfo mallinfo(void) __THROW ALIAS(tc_mallinfo);
#endif #endif