openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/rsyslog/8.1903.0-r0/rsyslog-8.1903.0/runtime/strgen.c
static rsRetVal AddStrgenToList(strgenList_t** ppListRoot, strgen_t* pStrgen)
{
    strgenList_t* pThis;
    strgenList_t* pTail;
    DEFiRet;

    CHKmalloc(pThis = malloc(sizeof(strgenList_t)));
    pThis->pStrgen = pStrgen;
    pThis->pNext = NULL;

    if (*ppListRoot == NULL)
    {
        pThis->pNext = *ppListRoot;
        *ppListRoot = pThis;
    }
    else
    {
        /* find tail first */
        for (pTail = *ppListRoot; pTail->pNext != NULL; pTail = pTail->pNext)
            /* just search, do nothing else */;
        /* add at tail */
        pTail->pNext = pThis;
    }

finalize_it:
    RETiRet;
}
/* Add a strgen to the list. We use a VERY simple and ineffcient algorithm,
 * but it is employed only for a few milliseconds during config processing. So
 * I prefer to keep it very simple and with simple data structures.
 * Unfortunately, we need to preserve the order, but I don't like to add a tail
 * pointer as that would require a container object. So I do the extra work to
 * skip to the tail when adding elements...
 */
Add a strgen to the list. We use a VERY simple and ineffcient algorithm,
but it is employed only for a few milliseconds during config processing. So
I prefer to keep it very simple and with simple data structures.
Unfortunately, we need to preserve the order, but I don't like to add a tail
pointer as that would require a container object. So I do the extra work to
skip to the tail when adding elements
Add a strgen to the list . We use a VERY simple and ineffcient algorithm but it is employed only for a few milliseconds during config processing . So I prefer to keep it very simple and with simple data structures . Unfortunately we need to preserve the order but I don ' t like to add a tail pointer as that would require a container object . So I do the extra work to skip to the tail when adding elements
static rsRetVal AddStrgenToList(strgenList_t** ppListRoot, strgen_t* pStrgen)
{
    strgenList_t* pThis;
    strgenList_t* pTail;
    DEFiRet;
    CHKmalloc(pThis = malloc(sizeof(strgenList_t)));
    pThis->pStrgen = pStrgen;
    pThis->pNext = NULL;
    if (*ppListRoot == NULL)
    {
        pThis->pNext = *ppListRoot;
        *ppListRoot = pThis;
    }
    else
    {
        for (pTail = *ppListRoot; pTail->pNext != NULL; pTail = pTail->pNext)
            ;
        pTail->pNext = pThis;
    }
finalize_it:
    RETiRet;
}
static rsRetVal AddStrgenToList ( strgenList_t * * ppListRoot , strgen_t * pStrgen ) { strgenList_t * pThis ; strgenList_t * pTail ; DEFiRet ; CHKmalloc ( pThis = malloc ( sizeof ( strgenList_t ) ) ) ; pThis -> pStrgen = pStrgen ; pThis -> pNext = NULL ; if ( * ppListRoot == NULL ) { pThis -> pNext = * ppListRoot ; * ppListRoot = pThis ; } else { for ( pTail = * ppListRoot ; pTail -> pNext != NULL ; pTail = pTail -> pNext ) ; pTail -> pNext = pThis ; } finalize_it : RETiRet ; }
Add a strgen to the list.
Add a strgen to the list .
/* find tail first */ /* just search, do nothing else */ /* add at tail */