agileRTOS (zrtos)  Version 0.8.0 (ghostbuster)
malloc_limit.h File Reference
#include <zrtos/malloc.h>
Include dependency graph for malloc_limit.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _zrtos_malloc_limit_t
 

Macros

#define ZRTOS_MALLOC_LIMIT__INIT()   {.length = 0}
 

Typedefs

typedef struct _zrtos_malloc_limit_t zrtos_malloc_limit_t
 

Functions

void * zrtos_malloc_limit__malloc (zrtos_malloc_limit_t *thiz, size_t length, size_t limit)
 
void zrtos_malloc_limit__free (zrtos_malloc_limit_t *thiz, void *ptr)
 

Macro Definition Documentation

◆ ZRTOS_MALLOC_LIMIT__INIT

#define ZRTOS_MALLOC_LIMIT__INIT ( )    {.length = 0}

Definition at line 23 of file malloc_limit.h.

Typedef Documentation

◆ zrtos_malloc_limit_t

Function Documentation

◆ zrtos_malloc_limit__free()

void zrtos_malloc_limit__free ( zrtos_malloc_limit_t thiz,
void *  ptr 
)

Definition at line 41 of file malloc_limit.h.

41  {
42  thiz->length -= zrtos_malloc__get_length(ptr);
43  kfree(ptr);
44 }
size_t zrtos_malloc__get_length(void *ptr)
Definition: malloc.h:205
Here is the call graph for this function:
Here is the caller graph for this function:

◆ zrtos_malloc_limit__malloc()

void* zrtos_malloc_limit__malloc ( zrtos_malloc_limit_t thiz,
size_t  length,
size_t  limit 
)

Definition at line 25 of file malloc_limit.h.

29  {
30  void *ret = 0;
31  size_t len = thiz->length + length;
32  if(len <= limit){
33  ret = kmalloc(length);
34  if(ret){
35  thiz->length = len;
36  }
37  }
38  return ret;
39 }
Here is the caller graph for this function: