php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
zend_ptr_stack.h File Reference
#include "zend_alloc.h"

Go to the source code of this file.

Data Structures

struct  _zend_ptr_stack
 

Macros

#define PTR_STACK_BLOCK_SIZE   64
 
#define ZEND_PTR_STACK_RESIZE_IF_NEEDED(stack, count)
 
#define ZEND_PTR_STACK_NUM_ARGS   3
 
#define ZEND_PTR_STACK_NUM_ARGS   2
 

Typedefs

typedef struct _zend_ptr_stack zend_ptr_stack
 

Functions

ZEND_API void zend_ptr_stack_init (zend_ptr_stack *stack)
 
ZEND_API void zend_ptr_stack_init_ex (zend_ptr_stack *stack, bool persistent)
 
ZEND_API void zend_ptr_stack_n_push (zend_ptr_stack *stack, int count,...)
 
ZEND_API void zend_ptr_stack_n_pop (zend_ptr_stack *stack, int count,...)
 
ZEND_API void zend_ptr_stack_destroy (zend_ptr_stack *stack)
 
ZEND_API void zend_ptr_stack_apply (zend_ptr_stack *stack, void(*func)(void *))
 
ZEND_API void zend_ptr_stack_reverse_apply (zend_ptr_stack *stack, void(*func)(void *))
 
ZEND_API void zend_ptr_stack_clean (zend_ptr_stack *stack, void(*func)(void *), bool free_elements)
 
ZEND_API int zend_ptr_stack_num_elements (zend_ptr_stack *stack)
 

Macro Definition Documentation

◆ PTR_STACK_BLOCK_SIZE

#define PTR_STACK_BLOCK_SIZE   64

Definition at line 33 of file zend_ptr_stack.h.

◆ ZEND_PTR_STACK_NUM_ARGS [1/2]

#define ZEND_PTR_STACK_NUM_ARGS   3

◆ ZEND_PTR_STACK_NUM_ARGS [2/2]

#define ZEND_PTR_STACK_NUM_ARGS   2

◆ ZEND_PTR_STACK_RESIZE_IF_NEEDED

#define ZEND_PTR_STACK_RESIZE_IF_NEEDED ( stack,
count )
Value:
if (stack->top+count > stack->max) { \
/* we need to allocate more memory */ \
do { \
stack->max += PTR_STACK_BLOCK_SIZE; \
} while (stack->top+count > stack->max); \
stack->elements = (void **) safe_perealloc(stack->elements, sizeof(void *), (stack->max), 0, stack->persistent); \
stack->top_element = stack->elements+stack->top; \
}
count(Countable|array $value, int $mode=COUNT_NORMAL)
#define safe_perealloc(ptr, nmemb, size, offset, persistent)
Definition zend_alloc.h:203
#define PTR_STACK_BLOCK_SIZE

Definition at line 47 of file zend_ptr_stack.h.

Typedef Documentation

◆ zend_ptr_stack

Function Documentation

◆ zend_ptr_stack_apply()

ZEND_API void zend_ptr_stack_apply ( zend_ptr_stack * stack,
void(* func )(void *) )

Definition at line 80 of file zend_ptr_stack.c.

◆ zend_ptr_stack_clean()

ZEND_API void zend_ptr_stack_clean ( zend_ptr_stack * stack,
void(* func )(void *),
bool free_elements )

Definition at line 99 of file zend_ptr_stack.c.

◆ zend_ptr_stack_destroy()

ZEND_API void zend_ptr_stack_destroy ( zend_ptr_stack * stack)

Definition at line 72 of file zend_ptr_stack.c.

◆ zend_ptr_stack_init()

ZEND_API void zend_ptr_stack_init ( zend_ptr_stack * stack)

Definition at line 31 of file zend_ptr_stack.c.

◆ zend_ptr_stack_init_ex()

ZEND_API void zend_ptr_stack_init_ex ( zend_ptr_stack * stack,
bool persistent )

Definition at line 24 of file zend_ptr_stack.c.

◆ zend_ptr_stack_n_pop()

ZEND_API void zend_ptr_stack_n_pop ( zend_ptr_stack * stack,
int count,
... )

Definition at line 55 of file zend_ptr_stack.c.

◆ zend_ptr_stack_n_push()

ZEND_API void zend_ptr_stack_n_push ( zend_ptr_stack * stack,
int count,
... )

Definition at line 37 of file zend_ptr_stack.c.

◆ zend_ptr_stack_num_elements()

ZEND_API int zend_ptr_stack_num_elements ( zend_ptr_stack * stack)

Definition at line 114 of file zend_ptr_stack.c.

◆ zend_ptr_stack_reverse_apply()

ZEND_API void zend_ptr_stack_reverse_apply ( zend_ptr_stack * stack,
void(* func )(void *) )

Definition at line 89 of file zend_ptr_stack.c.