Implements BinaryStack.
BinaryStack impl | Implements BinaryStack. |
Copyright | This program is free software. |
Files | |
C-kern/ | Header file BinaryStack. |
C-kern/ | Implementation file BinaryStack impl. |
blockheader_t | Header information of every allocated block. |
next | Points to previously allocated block. |
size | Size in bytes of this block. |
usedsize | The size of pushed objects stored in this block. |
lifetime | |
query | |
blocksize_blockheader | Returns the size of the allocated block usable pushing objects. |
usedsize_blockheader | Returns the number bytes used by pushed objects. |
freesize_blockheader | Returns the number of unused bytes. |
blockstart_blockheader | Returns the start address where pushed objects are stored. |
header_blockheader | Inverse operation to blockstart_blockheader. |
headersize_blockheader | Returns the size which needs to be allocated additional. |
binarystack_t | |
test | |
s_binarystack_errtimer | |
helper | |
allocateblock_binarystack | Allocates a block of memory. |
lifetime | |
change | |
size_binarystack | This function walks through all allocated blocks and counts the allocated size. |
change | |
test |
This program is free software. You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
© 2012 Jörg Seebohn
Header file BinaryStack.
Implementation file BinaryStack impl.
struct blockheader_t
Header information of every allocated block. This structure links a header to a previously allocated block. And it contains some book-keeping information.
next | Points to previously allocated block. |
size | Size in bytes of this block. |
usedsize | The size of pushed objects stored in this block. |
lifetime | |
query | |
blocksize_blockheader | Returns the size of the allocated block usable pushing objects. |
usedsize_blockheader | Returns the number bytes used by pushed objects. |
freesize_blockheader | Returns the number of unused bytes. |
blockstart_blockheader | Returns the start address where pushed objects are stored. |
header_blockheader | Inverse operation to blockstart_blockheader. |
headersize_blockheader | Returns the size which needs to be allocated additional. |
uint32_t size
Size in bytes of this block. The start address in memory is the same as blockheader_t.
static inline blockheader_t * header_blockheader( uint8_t * blockstart )
Inverse operation to blockstart_blockheader. Use it to get the address of blockheader_t computed from the value return from blockstart_blockheader.
test | |
s_binarystack_errtimer | |
helper | |
allocateblock_binarystack | Allocates a block of memory. |
lifetime | |
change | |
size_binarystack | This function walks through all allocated blocks and counts the allocated size. |
change | |
test |
static test_errortimer_t s_binarystack_errtimer
Header information of every allocated block.
struct blockheader_t
Points to previously allocated block.
blockheader_t * next
Size in bytes of this block.
uint32_t size
The size of pushed objects stored in this block.
uint32_t usedsize
Returns the size of the allocated block usable pushing objects.
static inline uint32_t blocksize_blockheader( blockheader_t * header )
Returns the number bytes used by pushed objects.
static inline uint32_t usedsize_blockheader( blockheader_t * header )
Returns the number of unused bytes.
static inline uint32_t freesize_blockheader( blockheader_t * header )
Returns the start address where pushed objects are stored.
static inline uint8_t * blockstart_blockheader( blockheader_t * header )
Inverse operation to blockstart_blockheader.
static inline blockheader_t * header_blockheader( uint8_t * blockstart )
Returns the size which needs to be allocated additional.
static inline uint32_t headersize_blockheader( void )
static test_errortimer_t s_binarystack_errtimer
Allocates a block of memory.
static int allocateblock_binarystack( binarystack_t * stack, uint32_t size )
This function walks through all allocated blocks and counts the allocated size.
size_t size_binarystack( binarystack_t * stack )