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/msg.c
static rsRetVal msgBaseConstruct(smsg_t** ppThis)
{
    DEFiRet;
    smsg_t* pM;

    assert(ppThis != NULL);
    CHKmalloc(pM = malloc(sizeof(smsg_t)));
    objConstructSetObjInfo(pM); /* intialize object helper entities */

    /* initialize members in ORDER they appear in structure (think "cache
     * line"!) */
    pM->flowCtlType = 0;
    pM->bParseSuccess = 0;
    pM->iRefCount = 1;
    pM->iSeverity = LOG_DEBUG;
    pM->iFacility = LOG_INVLD;
    pM->iLenPROGNAME = -1;
    pM->offAfterPRI = 0;
    pM->offMSG = 0;
    pM->iProtocolVersion = 0;
    pM->msgFlags = 0;
    pM->iLenRawMsg = 0;
    pM->iLenMSG = 0;
    pM->iLenTAG = 0;
    pM->iLenHOSTNAME = 0;
    pM->pszRawMsg = NULL;
    pM->pszHOSTNAME = NULL;
    pM->pszRcvdAt3164 = NULL;
    pM->pszRcvdAt3339 = NULL;
    pM->pszRcvdAt_MySQL = NULL;
    pM->pszRcvdAt_PgSQL = NULL;
    pM->pszTIMESTAMP3164 = NULL;
    pM->pszTIMESTAMP3339 = NULL;
    pM->pszTIMESTAMP_MySQL = NULL;
    pM->pszTIMESTAMP_PgSQL = NULL;
    pM->pszStrucData = NULL;
    pM->lenStrucData = 0;
    pM->pCSAPPNAME = NULL;
    pM->pCSPROCID = NULL;
    pM->pCSMSGID = NULL;
    pM->pInputName = NULL;
    pM->pRcvFromIP = NULL;
    pM->rcvFrom.pRcvFrom = NULL;
    pM->pRuleset = NULL;
    pM->json = NULL;
    pM->localvars = NULL;
    pM->dfltTZ[0] = '\0';
    memset(&pM->tRcvdAt, 0, sizeof(pM->tRcvdAt));
    memset(&pM->tTIMESTAMP, 0, sizeof(pM->tTIMESTAMP));
    pM->TAG.pszTAG = NULL;
    pM->pszTimestamp3164[0] = '\0';
    pM->pszTimestamp3339[0] = '\0';
    pM->pszTIMESTAMP_SecFrac[0] = '\0';
    pM->pszRcvdAt_SecFrac[0] = '\0';
    pM->pszTIMESTAMP_Unix[0] = '\0';
    pM->pszRcvdAt_Unix[0] = '\0';
    pM->pszUUID = NULL;
    pthread_mutex_init(&pM->mut, NULL);

    /* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/

    *ppThis = pM;

finalize_it:
    RETiRet;
}
/* This is common code for all Constructors. It is defined in an
 * inline'able function so that we can save a function call in the
 * actual constructors (otherwise, the msgConstruct would need
 * to call msgConstructWithTime(), which would require a
 * function call). Now, both can use this inline function. This
 * enables us to be optimal, but still have the code just once.
 * the new object or NULL if no such object could be allocated.
 * An object constructed via this function should only be destroyed
 * via "msgDestruct()". This constructor does not query system time
 * itself but rather uses a user-supplied value. This enables the caller
 * to do some tricks to save processing time (done, for example, in the
 * udp input).
 * NOTE: this constructor does NOT call calloc(), as we have many bytes
 * inside the structure which do not need to be cleared. bzero() will
 * heavily thrash the cache, so we do the init manually (which also
 * is the right thing to do with pointers, as they are not neccessarily
 * a binary 0 on all machines [but today almost always...]).
 * rgerhards, 2008-10-06
 */
This is common code for all Constructors. It is defined in an
inline'able function so that we can save a function call in the
actual constructors (otherwise, the msgConstruct would need
to call msgConstructWithTime(), which would require a
function call). Now, both can use this inline function. This
enables us to be optimal, but still have the code just once.
the new object or NULL if no such object could be allocated.
An object constructed via this function should only be destroyed
via "msgDestruct()". This constructor does not query system time
itself but rather uses a user-supplied value. This enables the caller
to do some tricks to save processing time (done, for example, in the
udp input).
NOTE: this constructor does NOT call calloc(), as we have many bytes
inside the structure which do not need to be cleared. bzero() will
heavily thrash the cache, so we do the init manually (which also
is the right thing to do with pointers, as they are not neccessarily
a binary 0 on all machines [but today almost always...]).
This is common code for all Constructors . It is defined in an inline ' able function so that we can save a function call in the actual constructors ( otherwise the msgConstruct would need to call msgConstructWithTime () which would require a function call ) . Now both can use this inline function . This enables us to be optimal but still have the code just once . the new object or NULL if no such object could be allocated . An object constructed via this function should only be destroyed via " msgDestruct () " . This constructor does not query system time itself but rather uses a user - supplied value . This enables the caller to do some tricks to save processing time ( done for example in the udp input ) . NOTE : this constructor does NOT call calloc () as we have many bytes inside the structure which do not need to be cleared . bzero () will heavily thrash the cache so we do the init manually ( which also is the right thing to do with pointers as they are not neccessarily a binary 0 on all machines [ but today almost always ... ] ) .
static rsRetVal msgBaseConstruct(smsg_t** ppThis)
{
    DEFiRet;
    smsg_t* pM;
    assert(ppThis != NULL);
    CHKmalloc(pM = malloc(sizeof(smsg_t)));
    objConstructSetObjInfo(pM); 
    pM->flowCtlType = 0;
    pM->bParseSuccess = 0;
    pM->iRefCount = 1;
    pM->iSeverity = LOG_DEBUG;
    pM->iFacility = LOG_INVLD;
    pM->iLenPROGNAME = -1;
    pM->offAfterPRI = 0;
    pM->offMSG = 0;
    pM->iProtocolVersion = 0;
    pM->msgFlags = 0;
    pM->iLenRawMsg = 0;
    pM->iLenMSG = 0;
    pM->iLenTAG = 0;
    pM->iLenHOSTNAME = 0;
    pM->pszRawMsg = NULL;
    pM->pszHOSTNAME = NULL;
    pM->pszRcvdAt3164 = NULL;
    pM->pszRcvdAt3339 = NULL;
    pM->pszRcvdAt_MySQL = NULL;
    pM->pszRcvdAt_PgSQL = NULL;
    pM->pszTIMESTAMP3164 = NULL;
    pM->pszTIMESTAMP3339 = NULL;
    pM->pszTIMESTAMP_MySQL = NULL;
    pM->pszTIMESTAMP_PgSQL = NULL;
    pM->pszStrucData = NULL;
    pM->lenStrucData = 0;
    pM->pCSAPPNAME = NULL;
    pM->pCSPROCID = NULL;
    pM->pCSMSGID = NULL;
    pM->pInputName = NULL;
    pM->pRcvFromIP = NULL;
    pM->rcvFrom.pRcvFrom = NULL;
    pM->pRuleset = NULL;
    pM->json = NULL;
    pM->localvars = NULL;
    pM->dfltTZ[0] = '\0';
    memset(&pM->tRcvdAt, 0, sizeof(pM->tRcvdAt));
    memset(&pM->tTIMESTAMP, 0, sizeof(pM->tTIMESTAMP));
    pM->TAG.pszTAG = NULL;
    pM->pszTimestamp3164[0] = '\0';
    pM->pszTimestamp3339[0] = '\0';
    pM->pszTIMESTAMP_SecFrac[0] = '\0';
    pM->pszRcvdAt_SecFrac[0] = '\0';
    pM->pszTIMESTAMP_Unix[0] = '\0';
    pM->pszRcvdAt_Unix[0] = '\0';
    pM->pszUUID = NULL;
    pthread_mutex_init(&pM->mut, NULL);
    *ppThis = pM;
finalize_it:
    RETiRet;
}
static rsRetVal msgBaseConstruct ( smsg_t * * ppThis ) { DEFiRet ; smsg_t * pM ; assert ( ppThis != NULL ) ; CHKmalloc ( pM = malloc ( sizeof ( smsg_t ) ) ) ; objConstructSetObjInfo ( pM ) ; pM -> flowCtlType = 0 ; pM -> bParseSuccess = 0 ; pM -> iRefCount = 1 ; pM -> iSeverity = LOG_DEBUG ; pM -> iFacility = LOG_INVLD ; pM -> iLenPROGNAME = -1 ; pM -> offAfterPRI = 0 ; pM -> offMSG = 0 ; pM -> iProtocolVersion = 0 ; pM -> msgFlags = 0 ; pM -> iLenRawMsg = 0 ; pM -> iLenMSG = 0 ; pM -> iLenTAG = 0 ; pM -> iLenHOSTNAME = 0 ; pM -> pszRawMsg = NULL ; pM -> pszHOSTNAME = NULL ; pM -> pszRcvdAt3164 = NULL ; pM -> pszRcvdAt3339 = NULL ; pM -> pszRcvdAt_MySQL = NULL ; pM -> pszRcvdAt_PgSQL = NULL ; pM -> pszTIMESTAMP3164 = NULL ; pM -> pszTIMESTAMP3339 = NULL ; pM -> pszTIMESTAMP_MySQL = NULL ; pM -> pszTIMESTAMP_PgSQL = NULL ; pM -> pszStrucData = NULL ; pM -> lenStrucData = 0 ; pM -> pCSAPPNAME = NULL ; pM -> pCSPROCID = NULL ; pM -> pCSMSGID = NULL ; pM -> pInputName = NULL ; pM -> pRcvFromIP = NULL ; pM -> rcvFrom . pRcvFrom = NULL ; pM -> pRuleset = NULL ; pM -> json = NULL ; pM -> localvars = NULL ; pM -> dfltTZ [ 0 ] = ' \0 ' ; memset ( & pM -> tRcvdAt , 0 , sizeof ( pM -> tRcvdAt ) ) ; memset ( & pM -> tTIMESTAMP , 0 , sizeof ( pM -> tTIMESTAMP ) ) ; pM -> TAG . pszTAG = NULL ; pM -> pszTimestamp3164 [ 0 ] = ' \0 ' ; pM -> pszTimestamp3339 [ 0 ] = ' \0 ' ; pM -> pszTIMESTAMP_SecFrac [ 0 ] = ' \0 ' ; pM -> pszRcvdAt_SecFrac [ 0 ] = ' \0 ' ; pM -> pszTIMESTAMP_Unix [ 0 ] = ' \0 ' ; pM -> pszRcvdAt_Unix [ 0 ] = ' \0 ' ; pM -> pszUUID = NULL ; pthread_mutex_init ( & pM -> mut , NULL ) ; * ppThis = pM ; finalize_it : RETiRet ; }
This is common code for all Constructors.
This is common code for all Constructors .
/* intialize object helper entities */ /* initialize members in ORDER they appear in structure (think "cache
     * line"!) */ /* DEV debugging only! dbgprintf("msgConstruct\t0x%x, ref 1\n", (int)pM);*/