manalloc.h
来自「含有多种公开密钥算法、多种块加密、多种数据流加密、多种HASH函数、多种Chec」· C头文件 代码 · 共 55 行
H
55 行
/************************************************** Managed Allocator Header File ** (C) 1999-2002 The Botan Project **************************************************/#ifndef BOTAN_MANAGED_ALLOCATOR_H__#define BOTAN_MANAGED_ALLOCATOR_H__#include <botan/secalloc.h>#include <botan/exceptn.h>#include <botan/mutex.h>#include <vector>#include <map>namespace Botan {/************************************************** Managed Allocator **************************************************/class ManagedAllocator : public SecureAllocator { public: struct Buffer { u32bit length; void* data; }; void* allocate(u32bit) const; void deallocate(void*, u32bit) const; ManagedAllocator(bool, u32bit = 1024); ~ManagedAllocator(); private: static const u32bit ALIGN_TO = 8; virtual void* alloc_block(u32bit) const = 0; virtual void dealloc_block(void*, u32bit) const = 0; void* find_free_block(u32bit) const; void defrag_free_list() const; u32bit find_buffer(void*) const; u32bit round_up(u32bit) const; bool same_buffer(Buffer&, Buffer&) const; bool overlap(Buffer, Buffer) const; void remove_empty_buffers(std::vector<Buffer>&) const; const u32bit pref_size; mutable std::map<void*, Buffer*> allocated; mutable std::vector<Buffer> free_list; mutable std::vector<Buffer> buffer_list; mutable Mutex* lock; };}#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?