src/ptra.c
l_int32
ptraAdd(L_PTRA  *pa,
        void    *item)
{
l_int32  imax;

    PROCNAME("ptraAdd");

    if (!pa)
        return ERROR_INT("pa not defined", procName, 1);
    if (!item)
        return ERROR_INT("item not defined", procName, 1);
    
    ptraGetMaxIndex(pa, &imax);
    if (imax >= pa->nalloc - 1 && ptraExtendArray(pa))
        return ERROR_INT("extension failure", procName, 1);
    pa->array[imax + 1] = (void *)item;
    pa->imax++;
    pa->nactual++;
    return 0;
}
/*!
 *  ptraAdd()
 *
 *      Input:  ptra
 *              item  (generic ptr to a struct)
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) This adds the element to the next location beyond imax,
 *          which is the largest occupied ptr in the array.  This is
 *          what you expect from a stack, where all ptrs up to and
 *          including imax are occupied, but here the occuption of
 *          items in the array is entirely arbitrary.
 */
ptraAdd()
Input:  ptra
item  (generic ptr to a struct)
Return: 0 if OK, 1 on error

(1) This adds the element to the next location beyond imax,
which is the largest occupied ptr in the array.  This is
what you expect from a stack, where all ptrs up to and
including imax are occupied, but here the occuption of
items in the array is entirely arbitrary.
ptraAdd () Input : ptra item ( generic ptr to a struct ) Return : 0 if OK 1 on error ( 1 ) This adds the element to the next location beyond imax which is the largest occupied ptr in the array . This is what you expect from a stack where all ptrs up to and including imax are occupied but here the occuption of items in the array is entirely arbitrary .
l_int32
ptraAdd(L_PTRA  *pa,
        void    *item)
{
l_int32  imax;
    PROCNAME("ptraAdd");
    if (!pa)
        return ERROR_INT("pa not defined", procName, 1);
    if (!item)
        return ERROR_INT("item not defined", procName, 1);
    ptraGetMaxIndex(pa, &imax);
    if (imax >= pa->nalloc - 1 && ptraExtendArray(pa))
        return ERROR_INT("extension failure", procName, 1);
    pa->array[imax + 1] = (void *)item;
    pa->imax++;
    pa->nactual++;
    return 0;
}
l_int32 ptraAdd ( L_PTRA * pa , void * item ) { l_int32 imax ; PROCNAME ( " " ) ; if ( ! pa ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! item ) return ERROR_INT ( " " , procName , 1 ) ; ptraGetMaxIndex ( pa , & imax ) ; if ( imax >= pa -> nalloc - 1 && ptraExtendArray ( pa ) ) return ERROR_INT ( " " , procName , 1 ) ; pa -> array [ imax + 1 ] = ( void * ) item ; pa -> imax ++ ; pa -> nactual ++ ; return 0 ; }
ptraAdd()
      Input:  ptra
              item  (generic ptr to a struct)
      Return: 0 if OK, 1 on error
ptraAdd () Input : ptra item ( generic ptr to a struct ) Return : 0 if OK 1 on error