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/template.c
void tplDeleteNew(rsconf_t* conf)
{
    struct template *pTpl, *pTplDel;
    struct templateEntry *pTpe, *pTpeDel;

    if (conf->templates.root == NULL || conf->templates.lastStatic == NULL)
        return;

    pTpl = conf->templates.lastStatic->pNext;
    conf->templates.lastStatic->pNext = NULL;
    conf->templates.last = conf->templates.lastStatic;
    while (pTpl != NULL)
    {
        pTpe = pTpl->pEntryRoot;
        while (pTpe != NULL)
        {
            pTpeDel = pTpe;
            pTpe = pTpe->pNext;
            switch (pTpeDel->eEntryType)
            {
                case UNDEFINED:
                    break;
                case CONSTANT:
                    free(pTpeDel->data.constant.pConstant);
                    break;
                case FIELD:
#ifdef FEATURE_REGEXP
                    /* check if we have a regexp and, if so, delete it */
                    if (pTpeDel->data.field.has_regex != 0)
                    {
                        if (objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK)
                        {
                            regexp.regfree(&(pTpeDel->data.field.re));
                        }
                    }
#endif
                    msgPropDescrDestruct(&pTpeDel->data.field.msgProp);
                    break;
            }
            free(pTpeDel);
        }
        pTplDel = pTpl;
        pTpl = pTpl->pNext;
        free(pTplDel->pszName);
        if (pTplDel->bHaveSubtree)
            msgPropDescrDestruct(&pTplDel->subtree);
        free(pTplDel);
    }
}
/* Destroy all templates obtained from conf file
 * preserving hardcoded ones. This is called from init().
 */
Destroy all templates obtained from conf file
preserving hardcoded ones. This is called from init().
Destroy all templates obtained from conf file preserving hardcoded ones . This is called from init () .
void tplDeleteNew(rsconf_t* conf)
{
    struct template *pTpl, *pTplDel;
    struct templateEntry *pTpe, *pTpeDel;
    if (conf->templates.root == NULL || conf->templates.lastStatic == NULL)
        return;
    pTpl = conf->templates.lastStatic->pNext;
    conf->templates.lastStatic->pNext = NULL;
    conf->templates.last = conf->templates.lastStatic;
    while (pTpl != NULL)
    {
        pTpe = pTpl->pEntryRoot;
        while (pTpe != NULL)
        {
            pTpeDel = pTpe;
            pTpe = pTpe->pNext;
            switch (pTpeDel->eEntryType)
            {
                case UNDEFINED:
                    break;
                case CONSTANT:
                    free(pTpeDel->data.constant.pConstant);
                    break;
                case FIELD:
#ifdef FEATURE_REGEXP
                    if (pTpeDel->data.field.has_regex != 0)
                    {
                        if (objUse(regexp, LM_REGEXP_FILENAME) == RS_RET_OK)
                        {
                            regexp.regfree(&(pTpeDel->data.field.re));
                        }
                    }
#endif
                    msgPropDescrDestruct(&pTpeDel->data.field.msgProp);
                    break;
            }
            free(pTpeDel);
        }
        pTplDel = pTpl;
        pTpl = pTpl->pNext;
        free(pTplDel->pszName);
        if (pTplDel->bHaveSubtree)
            msgPropDescrDestruct(&pTplDel->subtree);
        free(pTplDel);
    }
}
void tplDeleteNew ( rsconf_t * conf ) { struct template * pTpl , * pTplDel ; struct templateEntry * pTpe , * pTpeDel ; if ( conf -> templates . root == NULL || conf -> templates . lastStatic == NULL ) return ; pTpl = conf -> templates . lastStatic -> pNext ; conf -> templates . lastStatic -> pNext = NULL ; conf -> templates . last = conf -> templates . lastStatic ; while ( pTpl != NULL ) { pTpe = pTpl -> pEntryRoot ; while ( pTpe != NULL ) { pTpeDel = pTpe ; pTpe = pTpe -> pNext ; switch ( pTpeDel -> eEntryType ) { case UNDEFINED : break ; case CONSTANT : free ( pTpeDel -> data . constant . pConstant ) ; break ; case FIELD : #ifdef FEATURE_REGEXP if ( pTpeDel -> data . field . has_regex != 0 ) { if ( objUse ( regexp , LM_REGEXP_FILENAME ) == RS_RET_OK ) { regexp . regfree ( & ( pTpeDel -> data . field . re ) ) ; } } #endif msgPropDescrDestruct ( & pTpeDel -> data . field . msgProp ) ; break ; } free ( pTpeDel ) ; } pTplDel = pTpl ; pTpl = pTpl -> pNext ; free ( pTplDel -> pszName ) ; if ( pTplDel -> bHaveSubtree ) msgPropDescrDestruct ( & pTplDel -> subtree ) ; free ( pTplDel ) ; } }
Destroy all templates obtained from conf file
 preserving hardcoded ones.
Destroy all templates obtained from conf file preserving hardcoded ones .
/* check if we have a regexp and, if so, delete it */