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/prop.c
static rsRetVal CreateOrReuseStringProp(prop_t** ppThis, const uchar* psz,
                                        const int len)
{
    uchar* pszPrev;
    int lenPrev;
    DEFiRet;
    assert(ppThis != NULL);

    if (*ppThis == NULL)
    {
        /* we need to create a property */
        CHKiRet(CreateStringProp(ppThis, psz, len));
    }
    else
    {
        /* already exists, check if we can re-use it */
        GetString(*ppThis, &pszPrev, &lenPrev);
        if (len != lenPrev || ustrcmp(psz, pszPrev))
        {
            /* different, need to discard old & create new one */
            propDestruct(ppThis);
            CHKiRet(CreateStringProp(ppThis, psz, len));
        } /* else we can re-use the existing one! */
    }

finalize_it:
    RETiRet;
}
/* another one-stop function, quite useful: it takes a property pointer and
 * a string. If the string is already contained in the property, nothing
 * happens. If the string is different (or the pointer NULL), the current
 * property is destructed and a new one created. This can be used to get a
 * specific name in those cases where there is a good chance that the property
 * immediatly previously processed already contained the value we need - in
 * which case we save us all the creation overhead by just reusing the already
 * existing property).
 * rgerhards, 2009-07-01
 */
another one-stop function, quite useful: it takes a property pointer and
a string. If the string is already contained in the property, nothing
happens. If the string is different (or the pointer NULL), the current
property is destructed and a new one created. This can be used to get a
specific name in those cases where there is a good chance that the property
immediatly previously processed already contained the value we need - in
which case we save us all the creation overhead by just reusing the already
existing property).
another one - stop function quite useful : it takes a property pointer and a string . If the string is already contained in the property nothing happens . If the string is different ( or the pointer NULL ) the current property is destructed and a new one created . This can be used to get a specific name in those cases where there is a good chance that the property immediatly previously processed already contained the value we need - in which case we save us all the creation overhead by just reusing the already existing property ) .
static rsRetVal CreateOrReuseStringProp(prop_t** ppThis, const uchar* psz,
                                        const int len)
{
    uchar* pszPrev;
    int lenPrev;
    DEFiRet;
    assert(ppThis != NULL);
    if (*ppThis == NULL)
    {
        CHKiRet(CreateStringProp(ppThis, psz, len));
    }
    else
    {
        GetString(*ppThis, &pszPrev, &lenPrev);
        if (len != lenPrev || ustrcmp(psz, pszPrev))
        {
            propDestruct(ppThis);
            CHKiRet(CreateStringProp(ppThis, psz, len));
        } 
    }
finalize_it:
    RETiRet;
}
static rsRetVal CreateOrReuseStringProp ( prop_t * * ppThis , const uchar * psz , const int len ) { uchar * pszPrev ; int lenPrev ; DEFiRet ; assert ( ppThis != NULL ) ; if ( * ppThis == NULL ) { CHKiRet ( CreateStringProp ( ppThis , psz , len ) ) ; } else { GetString ( * ppThis , & pszPrev , & lenPrev ) ; if ( len != lenPrev || ustrcmp ( psz , pszPrev ) ) { propDestruct ( ppThis ) ; CHKiRet ( CreateStringProp ( ppThis , psz , len ) ) ; } } finalize_it : RETiRet ; }
another one-stop function, quite useful: it takes a property pointer and
 a string.
another one - stop function quite useful : it takes a property pointer and a string .
/* we need to create a property */ /* already exists, check if we can re-use it */ /* different, need to discard old & create new one */ /* else we can re-use the existing one! */