VirtualBox

Ignore:
Timestamp:
Nov 8, 2023 5:57:26 PM (13 months ago)
Author:
vboxsync
Message:

libs/xpcom/ipc: More conversion to IPRT infrastructure, bugref:10545

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmVector.cpp

    r31259 r101996  
    3838#include <stdlib.h>
    3939#include "tmVector.h"
    40 #ifdef VBOX_USE_IPRT_IN_XPCOM
    41 # include <iprt/mem.h>
    42 #endif
     40
     41#include <iprt/mem.h>
    4342
    4443////////////////////////////////////////////////////////////////////////////
     
    4948tmVector::~tmVector() {
    5049  if (mElements)
    51 #ifdef VBOX_USE_IPRT_IN_XPCOM
    5250    RTMemFree((void*)mElements);
    53 #else
    54     free((void*)mElements);
    55 #endif
    5651}
    5752
     
    6257tmVector::Init() {
    6358
    64 #ifdef VBOX_USE_IPRT_IN_XPCOM
    6559  mElements = (void**) RTMemAllocZ (mCapacity * sizeof(void*));
    66 #else
    67   mElements = (void**) calloc (mCapacity, sizeof(void*));
    68 #endif
    6960  if (!mElements)
    7061    return NS_ERROR_OUT_OF_MEMORY;
     
    7768PRInt32
    7869tmVector::Append(void *aElement){
    79   PR_ASSERT(aElement);
     70  Assert(aElement);
    8071
    8172  // make sure there is room
     
    9485void
    9586tmVector::Remove(void *aElement) {
    96   PR_ASSERT(aElement);
     87  Assert(aElement);
    9788
    9889  for (PRUint32 index = 0; index < mNext; index++) {
     
    111102void
    112103tmVector::RemoveAt(PRUint32 aIndex) {
    113   PR_ASSERT(aIndex < mNext);
     104  Assert(aIndex < mNext);
    114105
    115106  // remove the element if it isn't already nsnull
     
    148139
    149140  PRUint32 newcap = mCapacity + GROWTH_INC;
    150 #ifdef VBOX_USE_IPRT_IN_XPCOM
    151141  mElements = (void**) RTMemRealloc(mElements, (newcap * sizeof(void*)));
    152 #else
    153   mElements = (void**) realloc(mElements, (newcap * sizeof(void*)));
    154 #endif
    155142  if (mElements) {
    156143    mCapacity = newcap;
     
    167154  PRUint32 newcap = mCapacity - GROWTH_INC;
    168155  if (mNext < newcap) {
    169 #ifdef VBOX_USE_IPRT_IN_XPCOM
    170156    mElements = (void**) RTMemRealloc(mElements, newcap * sizeof(void*));
    171 #else
    172     mElements = (void**) realloc(mElements, newcap * sizeof(void*));
    173 #endif
    174157    if (!mElements)
    175158      return NS_ERROR_OUT_OF_MEMORY;
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