浏览代码

smalloc headers safe for C++

main
PaulStoffregen 4 年前
父节点
当前提交
98eef46654
共有 2 个文件被更改,包括 16 次插入0 次删除
  1. +8
    -0
      teensy4/smalloc.h
  2. +8
    -0
      teensy4/smalloc_i.h

+ 8
- 0
teensy4/smalloc.h 查看文件

#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 查看文件

#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

正在加载...
取消
保存