stringalloc.cpp revision 46b1264ee3b814435782dab838c9a212023e24b9
/* $Id$ */
/** @file
* IPRT - String Manipulation.
*/
/*
* Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*******************************************************************************
* Header Files *
*******************************************************************************/
#ifndef IN_RING0
#endif
{
if (psz)
*psz = '\0';
return psz;
}
{
if (psz)
{
*psz = '\0';
return VINF_SUCCESS;
}
return VERR_NO_STR_MEMORY;
}
{
if (!cbNew)
{
}
else if (pszOld)
{
if (!pszNew)
return VERR_NO_STR_MEMORY;
}
else
{
if (!pszNew)
return VERR_NO_STR_MEMORY;
pszNew[0] = '\0';
}
return VINF_SUCCESS;
}
{
if (pszString)
}
{
#if defined(__cplusplus)
#endif
if (psz)
return psz;
}
{
#if defined(__cplusplus)
#endif
if (psz)
{
*ppszString = psz;
return VINF_SUCCESS;
}
return VERR_NO_MEMORY;
}
{
#if defined(__cplusplus)
#endif
if (pszDst)
{
}
return pszDst;
}
{
if (!pszAppend)
return VINF_SUCCESS;
}
RTDECL(int) RTStrAAppendNTag(char **ppsz, const char *pszAppend, size_t cchAppend, const char *pszTag)
{
char *pszNew;
if (!cchAppend)
return VINF_SUCCESS;
else
if (!pszNew)
return VERR_NO_STR_MEMORY;
return VINF_SUCCESS;
}
#ifndef IN_RING0
/* XXX Currently not needed anywhere. alloca() induces some linker problems for ring 0 code
* with newer versions of VCC */
{
if (!cPairs)
return VINF_SUCCESS;
/*
* Determine the length of each string and calc the new total.
*/
struct RTStrAAppendExNVStruct
{
const char *psz;
{
cchNewTotal += cch;
}
cchNewTotal++; /* '\0' */
/*
* Try reallocate the string.
*/
if (!pszNew)
return VERR_NO_STR_MEMORY;
/*
* Do the appending.
*/
{
}
/* done */
return VINF_SUCCESS;
}
#endif
{
char *pszNew;
if (!cchNew)
{
{
*pszOld = '\0';
if (pszNew)
}
}
else
{
char *pszZero;
if (!pszZero)
{
if (pszNew)
}
}
return VINF_SUCCESS;
}