VirtualBox

Ignore:
Timestamp:
Oct 17, 2021 5:55:43 PM (3 years ago)
Author:
vboxsync
Message:

IPRT/strprintf2: Prep for splitting out the ellipsis functions. bugref:10124

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/strprintf2.cpp

    r82968 r91788  
    106106}
    107107
    108 
    109 RTDECL(ssize_t) RTStrPrintf2(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...)
     108RTDECL(ssize_t) RTStrPrintf2V(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args)
    110109{
    111     /* Explicitly inline RTStrPrintf2V + RTStrPrintf2ExV here because this is a frequently use API. */
    112110    STRPRINTF2OUTPUTARGS Args;
    113111    size_t cchRet;
    114     va_list args;
    115112    AssertMsg(cchBuffer > 0, ("Excellent idea! Format a string with no space for the output!\n"));
    116113
     
    119116    Args.fOverflowed = false;
    120117
    121     va_start(args, pszFormat);
    122118    cchRet = RTStrFormatV(rtStrPrintf2Output, &Args, NULL, NULL, pszFormat, args);
    123     va_end(args);
    124119
    125120    return !Args.fOverflowed ? (ssize_t)cchRet : -(ssize_t)cchRet - 1;
     121}
     122RT_EXPORT_SYMBOL(RTStrPrintf2V);
     123
     124
     125
     126RTDECL(ssize_t) RTStrPrintf2(char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...)
     127{
     128    va_list va;
     129    ssize_t cbRet;
     130    va_start(va, pszFormat);
     131    cbRet = RTStrPrintf2V(pszBuffer, cchBuffer, pszFormat, va);
     132    va_end(va);
     133    return cbRet;
    126134}
    127135RT_EXPORT_SYMBOL(RTStrPrintf2);
     
    144152
    145153
    146 RTDECL(ssize_t) RTStrPrintf2V(char *pszBuffer, size_t cchBuffer, const char *pszFormat, va_list args)
    147 {
    148     return RTStrPrintf2ExV(NULL, NULL, pszBuffer, cchBuffer, pszFormat, args);
    149 }
    150 RT_EXPORT_SYMBOL(RTStrPrintf2V);
    151 
    152 
    153154RTDECL(ssize_t) RTStrPrintf2Ex(PFNSTRFORMAT pfnFormat, void *pvArg, char *pszBuffer, size_t cchBuffer, const char *pszFormat, ...)
    154155{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette