VirtualBox

Changeset 102175 in vbox for trunk/src/libs


Ignore:
Timestamp:
Nov 21, 2023 8:29:54 AM (15 months ago)
Author:
vboxsync
Message:

libs/xpcom: Replace PL_strdup/PL_strndup/PL_strfree with IPRT equivalents, bugref:10545

Location:
trunk/src/libs/xpcom18a4
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/Makefile.kmk

    r102174 r102175  
    484484        nsprpub/lib/libc/src/strlen.c \
    485485        nsprpub/lib/libc/src/strcpy.c \
    486         nsprpub/lib/libc/src/strdup.c \
    487486        nsprpub/lib/libc/src/strcmp.c \
    488487        nsprpub/lib/libc/src/strccmp.c
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/src/tmTransactionService.cpp

    r1 r102175  
    3636 * ***** END LICENSE BLOCK ***** */
    3737
     38#include <iprt/string.h>
     39
    3840#include "nsCOMPtr.h"
    3941#include "nsIServiceManager.h"
     
    5658tm_waiting_msg::~tm_waiting_msg() {
    5759  if (domainName)
    58     PL_strfree(domainName);
     60    RTStrFree(domainName);
    5961}
    6062
     
    6971tm_queue_mapping::~tm_queue_mapping() {
    7072  if (domainName)
    71     PL_strfree(domainName);
     73    RTStrFree(domainName);
    7274  if (joinedQueueName)
    73     PL_strfree(joinedQueueName);
     75    RTStrFree(joinedQueueName);
    7476}
    7577
  • trunk/src/libs/xpcom18a4/nsprpub/lib/libc/include/plstr.h

    r102174 r102175  
    136136
    137137/*
    138  * PL_strdup
    139  *
    140  * Returns a pointer to a malloc'd extent of memory containing a duplicate
    141  * of the argument string.  The size of the allocated extent is one greater
    142  * than the length of the argument string, because of the terminator.  A
    143  * null argument, like a zero-length argument, will result in a pointer to
    144  * a one-byte extent containing the null value.  This routine returns null
    145  * upon malloc failure.
    146  */
    147 
    148 PR_EXTERN(char *)
    149 PL_strdup(const char *s);
    150 
    151 /*
    152  * PL_strfree
    153  *
    154  * Free memory allocated by PL_strdup
    155  */
    156 
    157 PR_EXTERN(void)
    158 PL_strfree(char *s);
    159 
    160 /*
    161  * PL_strndup
    162  *
    163  * Returns a pointer to a malloc'd extent of memory containing a duplicate
    164  * of the argument string, up to the maximum specified.  If the argument
    165  * string has a length greater than the value of the specified maximum, the
    166  * return value will be a pointer to an extent of memory of length one
    167  * greater than the maximum specified.  A null string, a zero-length string,
    168  * or a zero maximum will all result in a pointer to a one-byte extent
    169  * containing the null value.  This routine returns null upon malloc failure.
    170  */
    171 
    172 PR_EXTERN(char *)
    173 PL_strndup(const char *s, PRUint32 max);
    174 
    175 /*
    176138 * PL_strcmp
    177139 *
  • trunk/src/libs/xpcom18a4/xpcom/base/nsTraceRefcntImpl.cpp

    r101998 r102175  
    3737 * ***** END LICENSE BLOCK ***** */
    3838
     39#include <iprt/string.h>
     40
    3941#include "nsTraceRefcntImpl.h"
    4042#include "nscore.h"
     
    234236  BloatEntry(const char* className, PRUint32 classSize)
    235237    : mClassSize(classSize) {
    236     mClassName = PL_strdup(className);
     238    mClassName = RTStrDup(className);
    237239    Clear(&mNewStats);
    238240    Clear(&mAllStats);
     
    241243
    242244  ~BloatEntry() {
    243     PL_strfree(mClassName);
     245    RTStrFree(mClassName);
    244246  }
    245247
  • trunk/src/libs/xpcom18a4/xpcom/components/nsComponentManager.cpp

    r101989 r102175  
    8888
    8989#include <iprt/assert.h>
     90#include <iprt/string.h>
    9091#include <VBox/log.h>
    9192
     
    767768
    768769    mNLoaderData = NS_COMPONENT_TYPE_NATIVE;
    769     mLoaderData[mNLoaderData].type = PL_strdup(nativeComponentType);
     770    mLoaderData[mNLoaderData].type = RTStrDup(nativeComponentType);
    770771    mLoaderData[mNLoaderData].loader = mNativeComponentLoader;
    771772    NS_ADDREF(mLoaderData[mNLoaderData].loader);
     
    780781    }
    781782
    782     mLoaderData[mNLoaderData].type = PL_strdup(staticComponentType);
     783    mLoaderData[mNLoaderData].type = RTStrDup(staticComponentType);
    783784    mLoaderData[mNLoaderData].loader = mStaticComponentLoader;
    784785    NS_ADDREF(mLoaderData[mNLoaderData].loader);
     
    874875    for (i=0; i < mNLoaderData; i++) {
    875876        NS_IF_RELEASE(mLoaderData[i].loader);
    876         PL_strfree((char *)mLoaderData[i].type);
     877        RTStrFree((char *)mLoaderData[i].type);
    877878    }
    878879    PR_Free(mLoaderData);
     
    949950AutoRegEntry::~AutoRegEntry()
    950951{
    951     if (mName) PL_strfree(mName);
    952     if (mData) PL_strfree(mData);
     952    if (mName) RTStrFree(mName);
     953    if (mData) RTStrFree(mData);
    953954}
    954955
     
    963964{
    964965    if (mData)
    965         PL_strfree(mData);
     966        RTStrFree(mData);
    966967
    967968    if (!data) {
     
    970971    }
    971972
    972     mData = PL_strdup(data);
     973    mData = RTStrDup(data);
    973974}
    974975
     
    24272428
    24282429    if (!aSpec) {
    2429         *aRegistryName = PL_strdup("");
     2430        *aRegistryName = RTStrDup("");
    24302431        return NS_OK;
    24312432    }
     
    28442845
    28452846    typeIndex = mNLoaderData;
    2846     mLoaderData[typeIndex].type = PL_strdup(typeStr);
     2847    mLoaderData[typeIndex].type = RTStrDup(typeStr);
    28472848    if (!mLoaderData[typeIndex].type) {
    28482849        // mmh! no memory. return failure.
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsCRT.h

    r1 r102175  
    3737#ifndef nsCRT_h___
    3838#define nsCRT_h___
     39
     40#include <iprt/string.h>
    3941
    4042#include <stdlib.h>
     
    170172 
    171173  static char* strdup(const char* str) {
    172     return PL_strdup(str);
     174    return RTStrDup(str);
    173175  }
    174176
    175177  static char* strndup(const char* str, PRUint32 len) {
    176     return PL_strndup(str, len);
     178    return RTStrDupN(str, len);
    177179  }
    178180
    179181  static void free(char* str) {
    180     PL_strfree(str);
     182    RTStrFree(str);
    181183  }
    182184
  • trunk/src/libs/xpcom18a4/xpcom/proxy/src/nsProxyEvent.cpp

    r101967 r102175  
    4949 */
    5050
     51#include <iprt/string.h>
     52
    5153#include "nsProxyEvent.h"
    5254#include "nsProxyEventPrivate.h"
     
    177179                    case nsXPTType::T_CHAR_STR:
    178180                        mParameterList[i].val.p =
    179                             PL_strdup((const char *)ptr);
     181                            RTStrDup((const char *)ptr);
    180182                        break;
    181183                    case nsXPTType::T_WCHAR_STR:
     
    207209                    case nsXPTType::T_CHAR_STR:
    208210                    case nsXPTType::T_WCHAR_STR:
    209                         PL_strfree((char*) ptr);
     211                        RTStrFree((char*) ptr);
    210212                        break;
    211213                    case nsXPTType::T_DOMSTRING:
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