⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 memb.h

📁 uIP0.9版本
💻 H
字号:
/** * \addtogroup exampleapps * @{ *//** * \file * Memory block allocation routines. * \author Adam Dunkels <adam@sics.se> * */#ifndef __MEMB_H__#define __MEMB_H__/** * Declare a memory block. * * \param name The name of the memory block (later used with * memb_init(), memb_alloc() and memb_free()). * * \param size The size of each memory chunk, in bytes. * * \param num The total number of memory chunks in the block. * */#define MEMB(name, size, num) \        static char memb_mem[(size + 1) * num]; \        static struct memb_blocks name = {size, num, memb_mem}struct memb_blocks {  unsigned short size;  unsigned short num;  char *mem;};void  memb_init(struct memb_blocks *m);char *memb_alloc(struct memb_blocks *m);char  memb_ref(struct memb_blocks *m, char *ptr);char  memb_free(struct memb_blocks *m, char *ptr);#endif /* __MEMB_H__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -