Leptonica  1.54
Файл stack.c
#include "allheaders.h"

Функции

static l_int32 lstackExtendArray (L_STACK *lstack)
 
L_STACKlstackCreate (l_int32 nalloc)
 
void lstackDestroy (L_STACK **plstack, l_int32 freeflag)
 
l_int32 lstackAdd (L_STACK *lstack, void *item)
 
void * lstackRemove (L_STACK *lstack)
 
l_int32 lstackGetCount (L_STACK *lstack)
 
l_int32 lstackPrint (FILE *fp, L_STACK *lstack)
 

Переменные

static const l_int32 INITIAL_PTR_ARRAYSIZE = 20
 

Функции

◆ lstackAdd()

l_int32 lstackAdd ( L_STACK lstack,
void *  item 
)

lstackAdd()

Input:  lstack
        item to be added to the lstack
Return: 0 if OK; 1 on error.

◆ lstackCreate()

L_STACK* lstackCreate ( l_int32  nalloc)

lstackCreate()

Input:  nalloc (initial ptr array size; use 0 for default)
Return: lstack, or null on error

◆ lstackDestroy()

void lstackDestroy ( L_STACK **  plstack,
l_int32  freeflag 
)

lstackDestroy()

Input:  &lstack (<to be nulled>)
        freeflag (TRUE to free each remaining struct in the array)
Return: void

Notes: (1) If freeflag is TRUE, frees each struct in the array. (2) If freeflag is FALSE but there are elements on the array, gives a warning and destroys the array. This will cause a memory leak of all the items that were on the lstack. So if the items require their own destroy function, they must be destroyed before the lstack. (3) To destroy the lstack, we destroy the ptr array, then the lstack, and then null the contents of the input ptr.

◆ lstackExtendArray()

static l_int32 lstackExtendArray ( L_STACK lstack)
static

lstackExtendArray()

Input:  lstack
Return: 0 if OK; 1 on error

◆ lstackGetCount()

l_int32 lstackGetCount ( L_STACK lstack)

lstackGetCount()

Input:  lstack
Return: count, or 0 on error

◆ lstackPrint()

l_int32 lstackPrint ( FILE *  fp,
L_STACK lstack 
)

lstackPrint()

Input:  stream
        lstack
Return: 0 if OK; 1 on error

◆ lstackRemove()

void* lstackRemove ( L_STACK lstack)

lstackRemove()

Input:  lstack
Return: ptr to item popped from the top of the lstack,
        or null if the lstack is empty or on error

Переменные

◆ INITIAL_PTR_ARRAYSIZE

const l_int32 INITIAL_PTR_ARRAYSIZE = 20
static