Asterisk - The Open Source Telephony Project  18.5.0
Macros
stack_alloc.h File Reference

Temporary memory allocation on stack. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ALIGN(stack, size)   ((stack) += ((size) - (long)(stack)) & ((size) - 1))
 
#define ALLOC(var, size, type)   var = PUSH(stack, size, type)
 
#define PUSH(stack, size, type)   (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
 
#define VARDECL(var)   var
 

Detailed Description

Temporary memory allocation on stack.

Definition in file stack_alloc.h.

Macro Definition Documentation

◆ ALIGN

#define ALIGN (   stack,
  size 
)    ((stack) += ((size) - (long)(stack)) & ((size) - 1))

Aligns the stack to a 'size' boundary

Parameters
stackStack
sizeNew size boundary

Definition at line 97 of file stack_alloc.h.

◆ ALLOC

#define ALLOC (   var,
  size,
  type 
)    var = PUSH(stack, size, type)

Allocate 'size' elements of 'type' on stack

Parameters
varName of variable to allocate
sizeNumber of elements
typeType of element

Definition at line 111 of file stack_alloc.h.

Referenced by speex_resampler_process_float().

◆ PUSH

#define PUSH (   stack,
  size,
  type 
)    (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))

Allocates 'size' elements of type 'type' on the stack

Parameters
stackStack
sizeNumber of elements
typeType of element

Definition at line 99 of file stack_alloc.h.

◆ VARDECL

#define VARDECL (   var)    var

Declare variable on stack

Parameters
varVariable to declare

Definition at line 110 of file stack_alloc.h.

Referenced by speex_resampler_process_float().