VirtualBox

Changeset 24427 in vbox


Ignore:
Timestamp:
Nov 6, 2009 8:52:12 AM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
54480
Message:

iprt/string.h: Added a simpler allocating sprintf interface.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/string.h

    r23631 r24427  
    797797RTDECL(int) RTStrAPrintf(char **ppszBuffer, const char *pszFormat, ...);
    798798
     799/**
     800 * Allocating string printf, version 2.
     801 *
     802 * @returns Formatted string. Use RTStrFree() to free it. NULL when out of
     803 *          memory.
     804 * @param   pszFormat   The format string.
     805 * @param   args        The format argument.
     806 */
     807RTDECL(char *) RTStrAPrintf2V(const char *pszFormat, va_list args);
     808
     809/**
     810 * Allocating string printf, version2.
     811 *
     812 * @returns Formatted string. Use RTStrFree() to free it. NULL when out of
     813 *          memory.
     814 * @param   pszFormat   The format string.
     815 * @param   ...         The format argument.
     816 */
     817RTDECL(char *) RTStrAPrintf2(const char *pszFormat, ...);
    799818
    800819/**
  • trunk/src/VBox/Runtime/common/string/straprintf.cpp

    r21337 r24427  
    194194RT_EXPORT_SYMBOL(RTStrAPrintf);
    195195
     196
     197RTDECL(char *) RTStrAPrintf2V(const char *pszFormat, va_list args)
     198{
     199    char *pszBuffer;
     200    RTStrAPrintfV(&pszBuffer, pszFormat, args);
     201    return pszBuffer;
     202}
     203RT_EXPORT_SYMBOL(RTStrAPrintf2V);
     204
     205
     206RTDECL(char *) RTStrAPrintf2(const char *pszFormat, ...)
     207{
     208    va_list va;
     209    char   *pszBuffer;
     210
     211    va_start(va, pszFormat);
     212    RTStrAPrintfV(&pszBuffer, pszFormat, va);
     213    va_end(va);
     214
     215    return pszBuffer;
     216}
     217RT_EXPORT_SYMBOL(RTStrAPrintf2);
     218
Note: See TracChangeset for help on using the changeset viewer.

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