X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2Flib%2Fgscpaux%2Fblock_allocator.h;h=ae9fc4fc3813d64000186dc73783fa336a94396f;hb=804ea15b01566ac0de58781ca61870b4824d0e02;hp=cc5ab3508a60f94e92cca068e446cb90270112c8;hpb=07495effe193ca3f73c3bf0ce417068f9ac9dcdd;p=com%2Fgs-lite.git diff --git a/src/lib/gscpaux/block_allocator.h b/src/lib/gscpaux/block_allocator.h index cc5ab35..ae9fc4f 100644 --- a/src/lib/gscpaux/block_allocator.h +++ b/src/lib/gscpaux/block_allocator.h @@ -1,37 +1,37 @@ -// Distributed under the MIT license. Copyright (c) 2010, Ivan Vashchaev - -#ifndef BLOCK_ALLOCATOR_H -#define BLOCK_ALLOCATOR_H - -class block_allocator -{ -private: - struct block - { - size_t size; - size_t used; - char *buffer; - block *next; - }; - - block *m_head; - size_t m_blocksize; - - block_allocator(const block_allocator &); - block_allocator &operator=(block_allocator &); - -public: - block_allocator(size_t blocksize); - ~block_allocator(); - - // exchange contents with rhs - void swap(block_allocator &rhs); - - // allocate memory - void *malloc(size_t size); - - // free all allocated blocks - void free(); -}; - -#endif +// Distributed under the MIT license. Copyright (c) 2010, Ivan Vashchaev + +#ifndef BLOCK_ALLOCATOR_H +#define BLOCK_ALLOCATOR_H + +class block_allocator +{ +private: + struct block + { + size_t size; + size_t used; + char *buffer; + block *next; + }; + + block *m_head; + size_t m_blocksize; + + block_allocator(const block_allocator &); + block_allocator &operator=(block_allocator &); + +public: + block_allocator(size_t blocksize); + ~block_allocator(); + + // exchange contents with rhs + void swap(block_allocator &rhs); + + // allocate memory + void *malloc(size_t size); + + // free all allocated blocks + void free(); +}; + +#endif