Browse Source

smalloc headers safe for C++

teensy4-core
PaulStoffregen 4 years ago
parent
commit
98eef46654
2 changed files with 16 additions and 0 deletions
  1. +8
    -0
      teensy4/smalloc.h
  2. +8
    -0
      teensy4/smalloc_i.h

+ 8
- 0
teensy4/smalloc.h View File

#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>


#ifdef __cplusplus
extern "C" {
#endif

struct smalloc_pool; struct smalloc_pool;


typedef size_t (*smalloc_oom_handler)(struct smalloc_pool *, size_t); typedef size_t (*smalloc_oom_handler)(struct smalloc_pool *, size_t);
*/ */
int sm_malloc_stats(size_t *, size_t *, size_t *, int *); int sm_malloc_stats(size_t *, size_t *, size_t *, int *);


#ifdef __cplusplus
} // extern "C"
#endif

#endif #endif

+ 8
- 0
teensy4/smalloc_i.h View File

#include <limits.h> #include <limits.h>
#include <errno.h> #include <errno.h>


#ifdef __cplusplus
extern "C" {
#endif

struct smalloc_hdr { struct smalloc_hdr {
size_t rsz; /* real allocated size with overhead (if any) */ size_t rsz; /* real allocated size with overhead (if any) */
size_t usz; /* exact user size as reported by s_szalloc */ size_t usz; /* exact user size as reported by s_szalloc */


void *sm_realloc_pool_i(struct smalloc_pool *spool, void *p, size_t n, int nomove); void *sm_realloc_pool_i(struct smalloc_pool *spool, void *p, size_t n, int nomove);


#ifdef __cplusplus
} // extern "C"
#endif

#endif #endif

Loading…
Cancel
Save