Skip to content

Commit

Permalink
Merge branch 'feat/move-inline-in-header' into 'idf'
Browse files Browse the repository at this point in the history
feat(tlsf): Create header for remaining static inline functions

See merge request espressif/tlsf!13
  • Loading branch information
SoucheSouche committed Aug 29, 2024
2 parents ea82911 + e45fc9b commit 64170ec
Show file tree
Hide file tree
Showing 5 changed files with 610 additions and 596 deletions.
19 changes: 1 addition & 18 deletions tlsf.h → include/tlsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@

#include <stddef.h>
#include <stdbool.h>
#include "tlsf_common.h"

#if defined(__cplusplus)
extern "C" {
#endif

/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */
/* pool_t: a block of memory that TLSF can manage. */
typedef void* tlsf_t;
typedef void* pool_t;

/* Create/destroy a memory pool. */
tlsf_t tlsf_create(void* mem, size_t max_bytes);
tlsf_t tlsf_create_with_pool(void* mem, size_t pool_bytes, size_t max_bytes);
Expand All @@ -42,9 +38,6 @@ size_t tlsf_block_size(void* ptr);

/* Overheads/limits of internal structures. */
size_t tlsf_size(tlsf_t tlsf);
size_t tlsf_align_size(void);
size_t tlsf_block_size_min(void);
size_t tlsf_block_size_max(tlsf_t tlsf);
size_t tlsf_pool_overhead(void);
size_t tlsf_alloc_overhead(void);

Expand All @@ -65,16 +58,6 @@ void tlsf_walk_pool(pool_t pool, tlsf_walker walker, void* user);
int tlsf_check(tlsf_t tlsf);
int tlsf_check_pool(pool_t pool);

/*!
* @brief Weak function filling the given memory with a given fill pattern.
*
* @param start: pointer to the start of the memory region to fill
* @param size: size of the memory region to fill
* @param is_free: Indicate if the pattern to use the fill the region should be
* an after free or after allocation pattern.
*/
__attribute__((weak)) void block_absorb_post_hook(void *start, size_t size, bool is_free);

/**
* @brief Weak function called on every free block of memory allowing the user to implement
* application specific checks on the memory.
Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions tlsf_common.h → include/tlsf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once
#include <stddef.h>
#include <assert.h>
#include <stdbool.h>

#if defined(__cplusplus)
extern "C" {
Expand Down Expand Up @@ -44,6 +45,11 @@ enum tlsf_config
** Data structures and associated constants.
*/

/* tlsf_t: a TLSF structure. Can contain 1 to N pools. */
/* pool_t: a block of memory that TLSF can manage. */
typedef void* tlsf_t;
typedef void* pool_t;

/* A type used for casting when doing pointer arithmetic. */
typedef ptrdiff_t tlsfptr_t;

Expand Down
Loading

0 comments on commit 64170ec

Please sign in to comment.