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/modules.c
rsRetVal readyModForCnf(modInfo_t* pThis, cfgmodules_etry_t** ppNew,
                        cfgmodules_etry_t** ppLast)
{
    cfgmodules_etry_t* pNew = NULL;
    cfgmodules_etry_t* pLast;
    DEFiRet;
    assert(pThis != NULL);

    if (loadConf == NULL)
    {
        FINALIZE; /* we are in an early init state */
    }

    /* check for duplicates and, as a side-activity, identify last node */
    pLast = loadConf->modules.root;
    if (pLast != NULL)
    {
        while (1)
        { /* loop broken inside */
            if (pLast->pMod == pThis)
            {
                DBGPRINTF("module '%s' already in this config\n",
                          modGetName(pThis));
                if (strncmp((char*)modGetName(pThis),
                            "builtin:", sizeof("builtin:") - 1))
                {
                    LogError(
                        0, RS_RET_MODULE_ALREADY_IN_CONF,
                        "module '%s' already in this config, cannot be added\n",
                        modGetName(pThis));
                    ABORT_FINALIZE(RS_RET_MODULE_ALREADY_IN_CONF);
                }
                FINALIZE;
            }
            if (pLast->next == NULL)
                break;
            pLast = pLast->next;
        }
    }

    /* if we reach this point, pLast is the tail pointer and this module is new
     * inside the currently loaded config. So, iff it is an input module, let's
     * pass it a pointer which it can populate with a pointer to its module
     * conf.
     */

    CHKmalloc(pNew = malloc(sizeof(cfgmodules_etry_t)));
    pNew->canActivate = 1;
    pNew->next = NULL;
    pNew->pMod = pThis;

    if (pThis->beginCnfLoad != NULL)
    {
        CHKiRet(pThis->beginCnfLoad(&pNew->modCnf, loadConf));
    }

    *ppLast = pLast;
    *ppNew = pNew;
finalize_it:
    if (iRet != RS_RET_OK)
    {
        if (pNew != NULL)
            free(pNew);
    }
    RETiRet;
}
/* ready module for config processing. this includes checking if the module
 * is already in the config, so this function may return errors. Returns a
 * pointer to the last module inthe current config. That pointer needs to
 * be passed to addModToCnfLst() when it is called later in the process.
 */
ready module for config processing. this includes checking if the module
is already in the config, so this function may return errors. Returns a
pointer to the last module inthe current config. That pointer needs to
be passed to addModToCnfLst() when it is called later in the process.
ready module for config processing . this includes checking if the module is already in the config so this function may return errors . Returns a pointer to the last module inthe current config . That pointer needs to be passed to addModToCnfLst () when it is called later in the process .
rsRetVal readyModForCnf(modInfo_t* pThis, cfgmodules_etry_t** ppNew,
                        cfgmodules_etry_t** ppLast)
{
    cfgmodules_etry_t* pNew = NULL;
    cfgmodules_etry_t* pLast;
    DEFiRet;
    assert(pThis != NULL);
    if (loadConf == NULL)
    {
        FINALIZE; 
    }
    pLast = loadConf->modules.root;
    if (pLast != NULL)
    {
        while (1)
        { 
            if (pLast->pMod == pThis)
            {
                DBGPRINTF("module '%s' already in this config\n",
                          modGetName(pThis));
                if (strncmp((char*)modGetName(pThis),
                            "builtin:", sizeof("builtin:") - 1))
                {
                    LogError(
                        0, RS_RET_MODULE_ALREADY_IN_CONF,
                        "module '%s' already in this config, cannot be added\n",
                        modGetName(pThis));
                    ABORT_FINALIZE(RS_RET_MODULE_ALREADY_IN_CONF);
                }
                FINALIZE;
            }
            if (pLast->next == NULL)
                break;
            pLast = pLast->next;
        }
    }
    CHKmalloc(pNew = malloc(sizeof(cfgmodules_etry_t)));
    pNew->canActivate = 1;
    pNew->next = NULL;
    pNew->pMod = pThis;
    if (pThis->beginCnfLoad != NULL)
    {
        CHKiRet(pThis->beginCnfLoad(&pNew->modCnf, loadConf));
    }
    *ppLast = pLast;
    *ppNew = pNew;
finalize_it:
    if (iRet != RS_RET_OK)
    {
        if (pNew != NULL)
            free(pNew);
    }
    RETiRet;
}
rsRetVal readyModForCnf ( modInfo_t * pThis , cfgmodules_etry_t * * ppNew , cfgmodules_etry_t * * ppLast ) { cfgmodules_etry_t * pNew = NULL ; cfgmodules_etry_t * pLast ; DEFiRet ; assert ( pThis != NULL ) ; if ( loadConf == NULL ) { FINALIZE ; } pLast = loadConf -> modules . root ; if ( pLast != NULL ) { while ( 1 ) { if ( pLast -> pMod == pThis ) { DBGPRINTF ( " \n " , modGetName ( pThis ) ) ; if ( strncmp ( ( char * ) modGetName ( pThis ) , " " , sizeof ( " " ) - 1 ) ) { LogError ( 0 , RS_RET_MODULE_ALREADY_IN_CONF , " \n " , modGetName ( pThis ) ) ; ABORT_FINALIZE ( RS_RET_MODULE_ALREADY_IN_CONF ) ; } FINALIZE ; } if ( pLast -> next == NULL ) break ; pLast = pLast -> next ; } } CHKmalloc ( pNew = malloc ( sizeof ( cfgmodules_etry_t ) ) ) ; pNew -> canActivate = 1 ; pNew -> next = NULL ; pNew -> pMod = pThis ; if ( pThis -> beginCnfLoad != NULL ) { CHKiRet ( pThis -> beginCnfLoad ( & pNew -> modCnf , loadConf ) ) ; } * ppLast = pLast ; * ppNew = pNew ; finalize_it : if ( iRet != RS_RET_OK ) { if ( pNew != NULL ) free ( pNew ) ; } RETiRet ; }
ready module for config processing.
ready module for config processing .
/* we are in an early init state */ /* check for duplicates and, as a side-activity, identify last node */ /* loop broken inside */ /* if we reach this point, pLast is the tail pointer and this module is new
     * inside the currently loaded config. So, iff it is an input module, let's
     * pass it a pointer which it can populate with a pointer to its module
     * conf.
     */