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 jsonEncode(uchar * *ppRes, unsigned short* pbMustBeFreed,
                               int* pBufLen, int escapeAll)
    {
        unsigned buflen;
        uchar* pSrc;
        es_str_t* dst = NULL;
        DEFiRet;

        pSrc = *ppRes;
        buflen = (*pBufLen == -1) ? (int)ustrlen(pSrc) : *pBufLen;
        CHKiRet(jsonAddVal(pSrc, buflen, &dst, escapeAll));

        if (dst != NULL)
        {
            /* we updated the string and need to replace the
             * previous data.
             */
            if (*pbMustBeFreed)
                free(*ppRes);
            *ppRes = (uchar*)es_str2cstr(dst, NULL);
            *pbMustBeFreed = 1;
            *pBufLen = -1;
            es_deleteStr(dst);
        }

    finalize_it:
        RETiRet;
    }
/* encode a property in JSON escaped format. This is a helper
     * to MsgGetProp. It needs to update all provided parameters.
     * Note: Code is borrowed from libee (my own code, so ASL 2.0
     * is fine with it); this function may later be replaced by
     * some "better" and more complete implementation (maybe from
     * libee or its helpers).
     * For performance reasons, we begin to copy the string only
     * when we recognice that we actually need to do some escaping.
     * rgerhards, 2012-03-16
     */
encode a property in JSON escaped format. This is a helper
to MsgGetProp. It needs to update all provided parameters.
Note: Code is borrowed from libee (my own code, so ASL 2.0
is fine with it); this function may later be replaced by
some "better" and more complete implementation (maybe from
libee or its helpers).
For performance reasons, we begin to copy the string only
when we recognice that we actually need to do some escaping.
encode a property in JSON escaped format . This is a helper to MsgGetProp . It needs to update all provided parameters . Note : Code is borrowed from libee ( my own code so ASL 2 . 0 is fine with it ) ; this function may later be replaced by some " better " and more complete implementation ( maybe from libee or its helpers ) . For performance reasons we begin to copy the string only when we recognice that we actually need to do some escaping .
static rsRetVal jsonEncode(uchar * *ppRes, unsigned short* pbMustBeFreed,
                               int* pBufLen, int escapeAll)
    {
        unsigned buflen;
        uchar* pSrc;
        es_str_t* dst = NULL;
        DEFiRet;
        pSrc = *ppRes;
        buflen = (*pBufLen == -1) ? (int)ustrlen(pSrc) : *pBufLen;
        CHKiRet(jsonAddVal(pSrc, buflen, &dst, escapeAll));
        if (dst != NULL)
        {
            if (*pbMustBeFreed)
                free(*ppRes);
            *ppRes = (uchar*)es_str2cstr(dst, NULL);
            *pbMustBeFreed = 1;
            *pBufLen = -1;
            es_deleteStr(dst);
        }
    finalize_it:
        RETiRet;
    }
static rsRetVal jsonEncode ( uchar * * ppRes , unsigned short * pbMustBeFreed , int * pBufLen , int escapeAll ) { unsigned buflen ; uchar * pSrc ; es_str_t * dst = NULL ; DEFiRet ; pSrc = * ppRes ; buflen = ( * pBufLen == -1 ) ? ( int ) ustrlen ( pSrc ) : * pBufLen ; CHKiRet ( jsonAddVal ( pSrc , buflen , & dst , escapeAll ) ) ; if ( dst != NULL ) { if ( * pbMustBeFreed ) free ( * ppRes ) ; * ppRes = ( uchar * ) es_str2cstr ( dst , NULL ) ; * pbMustBeFreed = 1 ; * pBufLen = -1 ; es_deleteStr ( dst ) ; } finalize_it : RETiRet ; }
encode a property in JSON escaped format.
encode a property in JSON escaped format .
/* we updated the string and need to replace the
             * previous data.
             */