/usr/include/GTGMemory.h is in libgtg-dev 0.2+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | /**
* \file GTGMemory.h
* \version 0.1
* \brief
*
* This file defines a fast allocator for fixed-size blocks
*/
#ifndef GTG_MEMORY_H
#define GTG_MEMORY_H
#include <stdlib.h>
/**
* \defgroup GTGMemory Memory management
*/
struct gtg_memory {
void *first_mem;
void *current_mem;
size_t block_len;
long mem_len;
void *first_free;
long first_new;
long nb_allocated;
};
typedef struct gtg_memory *gtg_memory_t;
/**
* \ingroup GTGMemory
* \fn void gtg_block_memory_init(gtg_memory_t *memory, size_t block_size, long initial_block_number)
* \brief Initialize the allocator
* \param memory A memory describer
* \param block_size The block size to be allocated when malloc is called
* \param initial_block_number The number of blocks to allocate initialy
*/
void gtg_block_memory_init(gtg_memory_t *memory, size_t block_size, long initial_block_number);
/**
* \ingroup GTGMemory
* \fn void* gtg_block_malloc(gtg_memory_t memory);
* \brief Allocate a block of data
* \param memory The memory describer
* \return A pointer to a block or NULL if allocation failed
*/
void* gtg_block_malloc(gtg_memory_t memory);
/**
* \ingroup GTGMemory
* \fn void gtg_block_free(gtg_memory_t memory, void *ptr);
* \brief Free a block of data
* \param memory The memory describer
* \param ptr The block of data to free
*/
void gtg_block_free(gtg_memory_t memory, void *ptr);
#endif
|