VirtualBox

Changeset 31259 in vbox for trunk/src/libs/xpcom18a4


Ignore:
Timestamp:
Jul 30, 2010 8:02:05 PM (14 years ago)
Author:
vboxsync
Message:

xpcom: Use RTMem* for memory alloc so that we can more easily wrap direct it to the electric fence heap.

Location:
trunk/src/libs/xpcom18a4
Files:
18 edited

Legend:

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

    r29232 r31259  
    5959TEMPLATE_XPCOM_CFLAGS.linux        = -pthread -ansi
    6060TEMPLATE_XPCOM_CFLAGS.solaris      = -fno-omit-frame-pointer # for now anyway.
    61 TEMPLATE_XPCOM_DEFS                = MOZILLA_CLIENT=1 NDEBUG=1 _IMPL_NS_COM \
    62                                      XPCOM_DLL_BASE=\"$(basename $(notdir $(LIB_XPCOM)))\" \
    63                                      MOZ_DLL_SUFFIX=\"$(suffix $(LIB_XPCOM))\" \
    64                                      IN_RING3
     61TEMPLATE_XPCOM_DEFS                = \
     62        MOZILLA_CLIENT=1 \
     63        NDEBUG=1 \
     64        _IMPL_NS_COM \
     65        XPCOM_DLL_BASE=\"$(basename $(notdir $(LIB_XPCOM)))\" \
     66        MOZ_DLL_SUFFIX=\"$(suffix $(LIB_XPCOM))\" \
     67        IN_RING3 \
     68        VBOX_USE_IPRT_IN_XPCOM
    6569ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
    6670 TEMPLATE_XPCOM_DEFS              += VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
     
    191195TEMPLATE_XPCOMBLDPROG_EXTENDS             = VBOXBLDPROG
    192196## @todo Verify that this doesn't blow up because of template inheriance ordering. (we're assuming XPCOMEXE is expanded when this is being used.)
    193 TEMPLATE_XPCOMBLDPROG_DEFS                = $(TEMPLATE_VBOXBLDPROG_DEFS)                $(TEMPLATE_XPCOMEXE_DEFS)
     197TEMPLATE_XPCOMBLDPROG_DEFS                = \
     198        $(TEMPLATE_VBOXBLDPROG_DEFS) \
     199        $(filter-out VBOX_USE_IPRT_IN_XPCOM, $(TEMPLATE_XPCOMEXE_DEFS))
    194200TEMPLATE_XPCOMBLDPROG_DEFS.$(KBUILD_HOST) = $(TEMPLATE_VBOXBLDPROG_DEFS.$(KBUILD_HOST)) $(TEMPLATE_XPCOMEXE_DEFS.$(KBUILD_HOST))
    195201TEMPLATE_XPCOMBLDPROG_DEFS.x86            = $(TEMPLATE_VBOXBLDPROG_DEFS.x86)            $(TEMPLATE_XPCOMEXE_DEFS.x86)
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmTransaction.cpp

    r1 r31259  
    3838#include <stdlib.h>
    3939#include "tmTransaction.h"
     40#ifdef VBOX_USE_IPRT_IN_XPCOM
     41# include <iprt/mem.h>
     42#endif
    4043
    4144///////////////////////////////////////////////////////////////////////////////
     
    4447tmTransaction::~tmTransaction() {
    4548  if (mHeader)
     49#ifdef VBOX_USE_IPRT_IN_XPCOM
     50    RTMemFree(mHeader);
     51#else
    4652    free(mHeader);
     53#endif
    4754}
    4855
     
    5158nsresult
    5259tmTransaction::Init(PRUint32 aOwnerID,
    53                     PRInt32  aQueueID, 
    54                     PRUint32 aAction, 
    55                     PRInt32  aStatus, 
    56                     const PRUint8 *aMessage, 
     60                    PRInt32  aQueueID,
     61                    PRUint32 aAction,
     62                    PRInt32  aStatus,
     63                    const PRUint8 *aMessage,
    5764                    PRUint32 aLength) {
    5865  nsresult rv = NS_OK;
     
    6168  // indicates the message is the entire raw message
    6269  if (aQueueID == TM_INVALID_ID) {
     70#ifdef VBOX_USE_IPRT_IN_XPCOM
     71    header = (tmHeader*) RTMemAlloc(aLength);
     72#else
    6373    header = (tmHeader*) malloc(aLength);
     74#endif
    6475    if (header) {
    6576      mRawMessageLength = aLength;
     
    7081  }
    7182  else {   // need to create the tmHeader and concat the message
     83#ifdef VBOX_USE_IPRT_IN_XPCOM
     84    header = (tmHeader*) RTMemAlloc (sizeof(tmHeader) + aLength);
     85#else
    7286    header = (tmHeader*) malloc (sizeof(tmHeader) + aLength);
     87#endif
    7388    if (header) {
    7489      mRawMessageLength = sizeof(tmHeader) + aLength;
  • trunk/src/libs/xpcom18a4/ipc/ipcd/extensions/transmngr/common/tmVector.cpp

    r1 r31259  
    3838#include <stdlib.h>
    3939#include "tmVector.h"
     40#ifdef VBOX_USE_IPRT_IN_XPCOM
     41# include <iprt/mem.h>
     42#endif
    4043
    4144////////////////////////////////////////////////////////////////////////////
     
    4649tmVector::~tmVector() {
    4750  if (mElements)
     51#ifdef VBOX_USE_IPRT_IN_XPCOM
     52    RTMemFree((void*)mElements);
     53#else
    4854    free((void*)mElements);
     55#endif
    4956}
    5057
     
    5562tmVector::Init() {
    5663
     64#ifdef VBOX_USE_IPRT_IN_XPCOM
     65  mElements = (void**) RTMemAllocZ (mCapacity * sizeof(void*));
     66#else
    5767  mElements = (void**) calloc (mCapacity, sizeof(void*));
     68#endif
    5869  if (!mElements)
    5970    return NS_ERROR_OUT_OF_MEMORY;
     
    117128//tmVector::operator[](int index) {
    118129//  if (index < mNext && index >= 0)
    119 //    return mElements[index]; 
     130//    return mElements[index];
    120131//  return nsnull;
    121132//}
     
    137148
    138149  PRUint32 newcap = mCapacity + GROWTH_INC;
     150#ifdef VBOX_USE_IPRT_IN_XPCOM
     151  mElements = (void**) RTMemRealloc(mElements, (newcap * sizeof(void*)));
     152#else
    139153  mElements = (void**) realloc(mElements, (newcap * sizeof(void*)));
     154#endif
    140155  if (mElements) {
    141156    mCapacity = newcap;
     
    152167  PRUint32 newcap = mCapacity - GROWTH_INC;
    153168  if (mNext < newcap) {
     169#ifdef VBOX_USE_IPRT_IN_XPCOM
     170    mElements = (void**) RTMemRealloc(mElements, newcap * sizeof(void*));
     171#else
    154172    mElements = (void**) realloc(mElements, newcap * sizeof(void*));
     173#endif
    155174    if (!mElements)
    156175      return NS_ERROR_OUT_OF_MEMORY;
  • trunk/src/libs/xpcom18a4/ipc/ipcd/shared/src/ipcMessage.cpp

    r1 r31259  
    4040#include "prlog.h"
    4141#include "ipcMessage.h"
     42#ifdef VBOX_USE_IPRT_IN_XPCOM
     43# include <iprt/mem.h>
     44#endif
    4245
    4346ipcMessage::~ipcMessage()
    4447{
    4548    if (mMsgHdr)
     49#ifdef VBOX_USE_IPRT_IN_XPCOM
     50        RTMemFree(mMsgHdr);
     51#else
    4652        free(mMsgHdr);
     53#endif
    4754}
    4855
     
    5158{
    5259    if (mMsgHdr) {
     60#ifdef VBOX_USE_IPRT_IN_XPCOM
     61        RTMemFree(mMsgHdr);
     62#else
    5363        free(mMsgHdr);
     64#endif
    5465        mMsgHdr = NULL;
    5566    }
     
    6879    // copy buf if non-null
    6980    if (mMsgHdr) {
     81#ifdef VBOX_USE_IPRT_IN_XPCOM
     82        clone->mMsgHdr = (ipcMessageHeader *) RTMemDup(mMsgHdr, mMsgHdr->mLen);
     83#else
    7084        clone->mMsgHdr = (ipcMessageHeader *) malloc(mMsgHdr->mLen);
    7185        memcpy(clone->mMsgHdr, mMsgHdr, mMsgHdr->mLen);
     86#endif
    7287    }
    7388    else
     
    8499{
    85100    if (mMsgHdr)
     101#ifdef VBOX_USE_IPRT_IN_XPCOM
     102        RTMemFree(mMsgHdr);
     103#else
    86104        free(mMsgHdr);
     105#endif
    87106    mMsgComplete = PR_FALSE;
    88107
    89108    // allocate message data
    90109    PRUint32 msgLen = IPC_MSG_HEADER_SIZE + dataLen;
     110#ifdef VBOX_USE_IPRT_IN_XPCOM
     111    mMsgHdr = (ipcMessageHeader *) RTMemAlloc(msgLen);
     112#else
    91113    mMsgHdr = (ipcMessageHeader *) malloc(msgLen);
     114#endif
    92115    if (!mMsgHdr) {
    93116        mMsgHdr = NULL;
     
    123146ipcMessage::Equals(const nsID &target, const char *data, PRUint32 dataLen) const
    124147{
    125     return mMsgComplete && 
     148    return mMsgComplete &&
    126149           mMsgHdr->mTarget.Equals(target) &&
    127150           DataLen() == dataLen &&
     
    199222                bufLen -= count;
    200223                *bytesRead = count;
    201                
     224
    202225                if (MsgLen() > IPC_MSG_GUESSED_SIZE) {
    203226                    // realloc message buffer to the correct size
     227#ifdef VBOX_USE_IPRT_IN_XPCOM
     228                    mMsgHdr = (ipcMessageHeader *) RTMemRealloc(mMsgHdr, MsgLen());
     229#else
    204230                    mMsgHdr = (ipcMessageHeader *) realloc(mMsgHdr, MsgLen());
     231#endif
    205232                }
    206233            }
     
    212239            // allocate a partial buffer
    213240            PRUint32 msgLen = IPC_MSG_GUESSED_SIZE;
     241#ifdef VBOX_USE_IPRT_IN_XPCOM
     242            mMsgHdr = (ipcMessageHeader *) RTMemAlloc(msgLen);
     243#else
    214244            mMsgHdr = (ipcMessageHeader *) malloc(msgLen);
     245#endif
    215246            if (!mMsgHdr)
    216247                return PR_FAILURE;
     
    223254        else {
    224255            PRUint32 msgLen = *(PRUint32 *) buf;
     256#ifdef VBOX_USE_IPRT_IN_XPCOM
     257            mMsgHdr = (ipcMessageHeader *) RTMemAlloc(msgLen);
     258#else
    225259            mMsgHdr = (ipcMessageHeader *) malloc(msgLen);
     260#endif
    226261            if (!mMsgHdr)
    227262                return PR_FAILURE;
  • trunk/src/libs/xpcom18a4/ipc/ipcd/util/src/ipcMessageWriter.cpp

    r1 r31259  
    4040#include "prmem.h"
    4141#include <string.h>
     42#ifdef VBOX_USE_IPRT_IN_XPCOM
     43# include <iprt/mem.h>
     44#endif
    4245
    4346//*****************************************************************************
    4447// ipcMessageWriter
    45 //*****************************************************************************   
     48//*****************************************************************************
    4649
    4750ipcMessageWriter::~ipcMessageWriter()
    4851{
    4952  if (mBuf)
     53#ifdef VBOX_USE_IPRT_IN_XPCOM
     54    RTMemFree(mBuf);
     55#else
    5056    free(mBuf);
     57#endif
    5158}
    52  
     59
    5360void ipcMessageWriter::PutInt8(PRUint8 val)
    5461{
    55   if (EnsureCapacity(sizeof(PRUint8))) 
     62  if (EnsureCapacity(sizeof(PRUint8)))
    5663    *mBufPtr++ = val;
    5764}
     
    6067// are larger than a byte. On some platforms, that causes a performance penalty.
    6168// On other platforms, Tru64 for instance, it's an error.
    62  
     69
    6370void ipcMessageWriter::PutInt16(PRUint16 val)
    6471{
     
    7077  }
    7178}
    72  
     79
    7380void ipcMessageWriter::PutInt32(PRUint32 val)
    7481{
     
    7986    *mBufPtr++ = temp[1];
    8087    *mBufPtr++ = temp[2];
    81     *mBufPtr++ = temp[3];   
     88    *mBufPtr++ = temp[3];
    8289  }
    8390}
    84  
     91
    8592PRUint32 ipcMessageWriter::PutBytes(const void* src, PRUint32 n)
    8693{
     
    9299  return 0;
    93100}
    94    
     101
    95102PRBool ipcMessageWriter::GrowCapacity(PRInt32 sizeNeeded)
    96103{
     
    107114      return PR_FALSE;
    108115  }
    109    
     116
    110117  PRInt32 curPos = mBufPtr - mBuf;
     118#ifdef VBOX_USE_IPRT_IN_XPCOM
     119  mBuf = (PRUint8*)RTMemRealloc(mBuf, mCapacity);
     120#else
    111121  mBuf = (PRUint8*)realloc(mBuf, mCapacity);
     122#endif
    112123  if (!mBuf) {
    113124    mError = PR_TRUE;
  • trunk/src/libs/xpcom18a4/nsprpub/lib/libc/src/strdup.c

    r1 r31259  
    3939#include "prmem.h"
    4040#include <string.h>
     41#ifdef VBOX_USE_IPRT_IN_NSPR
     42#include <iprt/mem.h>
     43#endif
    4144
    4245PR_IMPLEMENT(char *)
     
    5154    n = strlen(s) + 1;
    5255
     56#ifdef VBOX_USE_IPRT_IN_NSPR
     57    rv = (char *)RTMemAlloc(n);
     58#else
    5359    rv = (char *)malloc(n);
     60#endif
    5461    if( (char *)0 == rv ) return rv;
    5562
     
    6269PL_strfree(char *s)
    6370{
     71#ifdef VBOX_USE_IPRT_IN_NSPR
     72    RTMemFree(s);
     73#else
    6474    free(s);
     75#endif
    6576}
    6677
     
    7687    l = PL_strnlen(s, max);
    7788
     89#ifdef VBOX_USE_IPRT_IN_NSPR
     90    rv = (char *)RTMemAlloc(l+1);
     91#else
    7892    rv = (char *)malloc(l+1);
     93#endif
    7994    if( (char *)0 == rv ) return rv;
    8095
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/io/prlog.c

    r11858 r31259  
    5151
    5252#if defined(VBOX) && defined(DEBUG)
    53 #include <iprt/initterm.h> /* for RTR3Init */
    54 #include <iprt/log.h>
     53# include <iprt/initterm.h> /* for RTR3Init */
     54# include <iprt/log.h>
     55#endif
     56#ifdef VBOX_USE_IPRT_IN_NSPR
     57# include <iprt/string.h>
    5558#endif
    5659
     
    337340    while (lm != NULL) {
    338341        PRLogModuleInfo *next = lm->next;
     342#ifdef VBOX_USE_IPRT_IN_NSPR
     343        RTStrFree((/*const*/ char *)lm->name);
     344#else
    339345        free((/*const*/ char *)lm->name);
     346#endif
    340347        PR_Free(lm);
    341348        lm = next;
     
    395402    lm = PR_NEWZAP(PRLogModuleInfo);
    396403    if (lm) {
     404#ifdef VBOX_USE_IPRT_IN_NSPR
     405        lm->name = RTStrDup(name);
     406#else
    397407        lm->name = strdup(name);
     408#endif
    398409        lm->level = PR_LOG_NONE;
    399410        lm->next = logModules;
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/linking/prlink.c

    r16397 r31259  
    113113
    114114#endif /* !VBOX_USE_MORE_IPRT_IN_NSPR */
     115#ifdef VBOX_USE_IPRT_IN_NSPR
     116# include <iprt/mem.h>
     117# include <iprt/string.h>
     118# undef  strdup
     119# define strdup(str) RTStrDup(str)
     120#endif
    115121
    116122#define _PR_DEFAULT_LD_FLAGS PR_LD_LAZY
     
    418424
    419425    if (_pr_currentLibPath) {
     426#ifdef VBOX_USE_IPRT_IN_NSPR
     427        RTStrFree(_pr_currentLibPath);
     428#else
    420429        free(_pr_currentLibPath);
     430#endif
    421431        _pr_currentLibPath = NULL;
    422432    }
     
    437447    PR_EnterMonitor(pr_linker_lock);
    438448    if (_pr_currentLibPath) {
     449#ifdef VBOX_USE_IPRT_IN_NSPR
     450        RTStrFree(_pr_currentLibPath);
     451#else
    439452        free(_pr_currentLibPath);
     453#endif
    440454    }
    441455    if (path) {
     
    488502
    489503    len = strlen(ev) + 1;        /* +1 for the null */
     504# ifdef VBOX_USE_IPRT_IN_NSPR
     505    p = (char*) RTStrAlloc(len);
     506# else
    490507    p = (char*) malloc(len);
     508# endif
    491509    if (p) {
    492510        strcpy(p, ev);
     
    519537    len = strlen(ev) + 1;        /* +1 for the null */
    520538
     539# ifdef VBOX_USE_IPRT_IN_NSPR
     540    p = (char*) RTStrAlloc(len);
     541# else
    521542    p = (char*) malloc(len);
     543# endif
    522544    if (p) {
    523545        strcpy(p, ev);
     
    530552    /* AFAIK there isn't a library path with the HP SHL interface --Rob */
    531553    ev = strdup("");
    532 #endif
     554# endif
    533555#endif
    534556
     
    540562  exit:
    541563    if (_pr_currentLibPath) {
     564#ifdef VBOX_USE_IPRT_IN_NSPR
     565        copy = RTMemDup(_pr_currentLibPath, strlen(_pr_currentLibPath) + 1);
     566#else
    542567        copy = strdup(_pr_currentLibPath);
     568#endif
    543569    }
    544570    PR_ExitMonitor(pr_linker_lock);
     
    14751501  freeLib:
    14761502    PR_LOG(_pr_linker_lm, PR_LOG_MIN, ("Unloaded library %s", lib->name));
     1503#ifdef VBOX_USE_IPRT_IN_NSPR
     1504    RTStrFree(lib->name);
     1505#else
    14771506    free(lib->name);
     1507#endif
    14781508    lib->name = NULL;
    14791509    PR_DELETE(lib);
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/malloc/prmem.c

    r31253 r31259  
    4141
    4242#include "primpl.h"
    43 #ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     43#ifdef VBOX_USE_IPRT_IN_NSPR
    4444# include <iprt/mem.h>
    4545#endif
     
    108108                MemBlockHdr *hdr = mz->head;
    109109                mz->head = hdr->s.next;  /* unlink it */
     110#ifdef VBOX_USE_IPRT_IN_NSPR
     111                RTMemFree(hdr);
     112#else
    110113                free(hdr);
     114#endif
    111115                mz->elements--;
    112116            }
     
    281285        pthread_mutex_unlock(&mz->lock);
    282286
     287#ifdef VBOX_USE_IPRT_IN_NSPR
     288        mb = (MemBlockHdr *)RTMemAlloc(blockSize + 2 * (sizeof *mb));
     289#else
    283290        mb = (MemBlockHdr *)malloc(blockSize + 2 * (sizeof *mb));
     291#endif
    284292        if (!mb) {
    285293            PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
     
    301309    /* size was too big.  Create a block with no zone */
    302310    blockSize = (size & 15) ? size + 16 - (size & 15) : size;
     311#ifdef VBOX_USE_IPRT_IN_NSPR
     312    mb = (MemBlockHdr *)RTMemAlloc(blockSize + 2 * (sizeof *mb));
     313#else
    303314    mb = (MemBlockHdr *)malloc(blockSize + 2 * (sizeof *mb));
     315#endif
    304316    if (!mb) {
    305317        PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
     
    351363#endif
    352364        /* We don't know how big it is.  But we can fix that. */
     365#ifdef VBOX_USE_IPRT_IN_NSPR
     366        oldptr = RTMemRealloc(oldptr, bytes);
     367#else
    353368        oldptr = realloc(oldptr, bytes);
     369#endif
    354370        if (!oldptr) {
    355371            if (bytes) {
     
    384400            pr_ZoneFree(oldptr);
    385401        else if (oldptr)
     402#ifdef VBOX_USE_IPRT_IN_NSPR
     403            RTMemFree(oldptr);
     404#else
    386405            free(oldptr);
     406#endif
    387407    }
    388408    return rv;
     
    408428            "Warning: freeing memory block %p from ordinary malloc\n", ptr);
    409429#endif
     430#ifdef VBOX_USE_IPRT_IN_NSPR
     431        RTMemFree(ptr);
     432#else
    410433        free(ptr);
     434#endif
    411435        return;
    412436    }
     
    421445        PR_ASSERT(blockSize > 65536);
    422446        /* This block was not in any zone.  Just free it. */
     447#ifdef VBOX_USE_IPRT_IN_NSPR
     448        RTMemFree(mb);
     449#else
    423450        free(mb);
     451#endif
    424452        return;
    425453    }
     
    441469    if (!_pr_initialized) _PR_ImplicitInitialization();
    442470
    443 #ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     471#ifdef VBOX_USE_IPRT_IN_NSPR
    444472    return use_zone_allocator ? pr_ZoneMalloc(size) : RTMemAlloc(size);
    445473#else
     
    453481
    454482    return use_zone_allocator ?
    455 #ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     483#ifdef VBOX_USE_IPRT_IN_NSPR
    456484        pr_ZoneCalloc(nelem, elsize) : RTMemAllocZ(nelem * (size_t)elsize);
    457485#else
     
    464492    if (!_pr_initialized) _PR_ImplicitInitialization();
    465493
    466 #ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     494#ifdef VBOX_USE_IPRT_IN_NSPR
    467495    return use_zone_allocator ? pr_ZoneRealloc(ptr, size) : RTMemRealloc(ptr, size);
    468496#else
     
    476504        pr_ZoneFree(ptr);
    477505    else
    478 #ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     506#ifdef VBOX_USE_IPRT_IN_NSPR
    479507        RTMemFree(ptr);
    480508#else
     
    498526    return PR_MD_malloc( (size_t) size);
    499527#else
    500 # ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     528# ifdef VBOX_USE_IPRT_IN_NSPR
    501529    return RTMemAlloc(size);
    502530# else
     
    512540
    513541#else
    514 # ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     542# ifdef VBOX_USE_IPRT_IN_NSPR
    515543    return RTMemAllocZ(nelem * (size_t)elsize);
    516544# else
     
    525553    return PR_MD_realloc( ptr, (size_t) size);
    526554#else
    527 # ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     555# ifdef VBOX_USE_IPRT_IN_NSPR
    528556    return RTMemRealloc(ptr, size);
    529557# else
     
    538566    PR_MD_free( ptr );
    539567#else
    540 # ifdef VBOX_USE_MORE_IPRT_IN_NSPR
     568# ifdef VBOX_USE_IPRT_IN_NSPR
    541569    RTMemFree(ptr);
    542570# else
  • trunk/src/libs/xpcom18a4/nsprpub/pr/src/misc/prdtoa.c

    r1 r31259  
    267267#endif
    268268#else
     269# ifdef VBOX_USE_IPRT_IN_NSPR
     270#  include <iprt/mem.h>
     271#  define MALLOC RTMemAlloc
     272# else
    269273#define MALLOC malloc
     274# endif
    270275#endif
    271276
     
    34193424    }
    34203425    freedtoa(result);
    3421     return rv; 
     3426    return rv;
    34223427}
    34233428
     
    34273432** point value.
    34283433** This should be reparameterized so that you can send in a
    3429 **   prcn for the positive and negative ranges.  For now, 
     3434**   prcn for the positive and negative ranges.  For now,
    34303435**   conform to the ECMA JavaScript spec which says numbers
    34313436**   less than 1e-6 are in scientific notation.
  • trunk/src/libs/xpcom18a4/xpcom/components/xcDll.cpp

    r1 r31259  
    7474
    7575#include "nsNativeComponentLoader.h"
     76#ifdef VBOX_USE_IPRT_IN_XPCOM
     77# include "nsMemory.h"
     78#endif
    7679
    7780nsDll::nsDll(nsIFile *dllSpec, nsNativeComponentLoader *loader)
    7881    : m_dllSpec(do_QueryInterface(dllSpec)),
    79       m_instance(NULL), 
     82      m_instance(NULL),
    8083      m_moduleObject(NULL),
    8184      m_loader(loader),
     
    102105{
    103106    m_dllSpec->GetNativeLeafName(aLeafName);
    104    
     107
    105108    if (aLeafName.IsEmpty())
    106109        aLeafName.AssignLiteral("unknown!");
     
    120123        return PR_TRUE;
    121124    PRBool changed = PR_TRUE;
    122     manager->HasFileChanged(m_dllSpec, nsnull, currentDate, &changed); 
     125    manager->HasFileChanged(m_dllSpec, nsnull, currentDate, &changed);
    123126    return changed;
    124127}
     
    137140        nsTraceRefcntImpl::SetActivityIsLegal(PR_FALSE);
    138141#endif
    139        
     142
    140143    // Load any library dependencies
    141144    //   The Component Loader Manager may hold onto some extra data
    142     //   set by either the native component loader or the native 
     145    //   set by either the native component loader or the native
    143146    //   component.  We assume that this data is a space delimited
    144147    //   listing of dependent libraries which are required to be
    145148    //   loaded prior to us loading the given component.  Once, the
    146     //   component is loaded into memory, we can release our hold 
    147     //   on the dependent libraries with the assumption that the 
     149    //   component is loaded into memory, we can release our hold
     150    //   on the dependent libraries with the assumption that the
    148151    //   component library holds a reference via the OS so loader.
    149152
     
    155158    nsXPIDLCString extraData;
    156159    manager->GetOptionalData(m_dllSpec, nsnull, getter_Copies(extraData));
    157    
     160
    158161#ifdef UNLOAD_DEPENDENT_LIBS
    159162    nsVoidArray dependentLibArray;
     
    161164
    162165    // if there was any extra data, treat it as a listing of dependent libs
    163     if (extraData != nsnull) 
     166    if (extraData != nsnull)
    164167    {
    165168        // all dependent libraries are suppose to be in the "gre" directory.
    166         // note that the gre directory is the same as the "bin" directory, 
     169        // note that the gre directory is the same as the "bin" directory,
    167170        // when there isn't a real "gre" found.
    168171
     
    170173        nsCOMPtr<nsIFile> file;
    171174        NS_GetSpecialDirectory(NS_GRE_DIR, getter_AddRefs(file));
    172        
     175
    173176        if (!file)
    174177            return NS_ERROR_FAILURE;
     
    178181        file->AppendNative(NS_LITERAL_CSTRING("dummy"));
    179182
    180         char *buffer = strdup(extraData);
     183# ifdef VBOX_USE_IPRT_IN_XPCOM
     184        char *buffer = (char *)nsMemory::Clone(extraData, strlen(extraData) + 1);
     185# else
     186        char *buffer = strdup(extraData);
     187# endif
    181188        if (!buffer)
    182189            return NS_ERROR_OUT_OF_MEMORY;
     
    200207                return NS_ERROR_FAILURE;
    201208
    202             // Load this dependent library with the global flag and stash 
     209            // Load this dependent library with the global flag and stash
    203210            // the result for later so that we can unload it.
    204211            PRLibSpec libSpec;
    205212            libSpec.type = PR_LibSpec_Pathname;
    206213
    207             // if the depend library path starts with a / we are 
     214            // if the depend library path starts with a / we are
    208215            // going to assume that it is a full path and should
    209             // be loaded without prepending the gre diretory 
    210             // location.  We could have short circuited the 
     216            // be loaded without prepending the gre diretory
     217            // location.  We could have short circuited the
    211218            // SetNativeLeafName above, but this is clearer and
    212219            // the common case is a relative path.
     
    216223            else
    217224                libSpec.value.pathname = path;
    218            
     225
    219226            PRLibrary* lib = PR_LoadLibraryWithFlags(libSpec, PR_LD_LAZY|PR_LD_GLOBAL);
    220227            // if we couldn't load the dependent library.  We did the best we
     
    222229            // dependency.
    223230#ifdef UNLOAD_DEPENDENT_LIBS
    224             if (lib) 
     231            if (lib)
    225232                dependentLibArray.AppendElement((void*)lib);
    226233#endif
    227                
     234
    228235            token = nsCRT::strtok(newStr, " ", &newStr);
    229236        }
     237# ifdef VBOX_USE_IPRT_IN_XPCOM
     238        nsMemory::Free(buffer);
     239# else
    230240        free(buffer);
     241# endif
    231242    }
    232243#endif
     
    234245    // load the component
    235246    nsCOMPtr<nsILocalFile> lf(do_QueryInterface(m_dllSpec));
    236     NS_ASSERTION(lf, "nsIFile here must implement a nsILocalFile"); 
     247    NS_ASSERTION(lf, "nsIFile here must implement a nsILocalFile");
    237248    lf->Load(&m_instance);
    238249
    239250#if defined(XP_UNIX)
    240     // Unload any of library dependencies we loaded earlier. The assumption 
     251    // Unload any of library dependencies we loaded earlier. The assumption
    241252    // here is that the component will have a "internal" reference count to
    242     // the dependency library we just loaded. 
     253    // the dependency library we just loaded.
    243254    // XXX should we unload later - or even at all?
    244255
     
    306317        if (symbol == NULL)
    307318                return (NULL);
    308        
     319
    309320        // If not already loaded, load it now.
    310321        if (Load() != PR_TRUE)
  • trunk/src/libs/xpcom18a4/xpcom/ds/nsRecyclingAllocator.cpp

    r1 r31259  
    4949#include "prprf.h"
    5050#include "nsITimer.h"
     51#ifdef VBOX_USE_IPRT_IN_XPCOM
     52# include <iprt/mem.h>
     53#endif
    5154
    5255#define NS_SEC_TO_MS(s) ((s) * 1000)
     
    103106    while(mFreeList)
    104107    {
     108#ifdef VBOX_USE_IPRT_IN_XPCOM
     109        RTMemFree(mFreeList->block);
     110#else
    105111        free(mFreeList->block);
     112#endif
    106113        mFreeList = mFreeList->next;
    107114    }
    108115    mFreeList = nsnull;
    109    
     116
    110117    if (mBlocks)
    111118        delete [] mBlocks;
     
    143150    while(mFreeList)
    144151    {
     152#ifdef VBOX_USE_IPRT_IN_XPCOM
     153        RTMemFree(mFreeList->block);
     154#else
    145155        free(mFreeList->block);
     156#endif
    146157        mFreeList = mFreeList->next;
    147158    }
    148159    mFreeList = nsnull;
    149    
     160
    150161    if (mBlocks)
    151162        delete [] mBlocks;
     
    165176    // timer based release of unused memory.
    166177    Touch();
    167  
     178
    168179    Block* freeBlock = FindFreeBlock(bytes);
    169180    if (freeBlock)
     
    175186        return data;
    176187    }
    177      
     188
    178189    // We need to do an allocation
    179190    // Add 4 bytes to what we allocate to hold the bucket index
    180191    PRSize allocBytes = bytes + NS_ALLOCATOR_OVERHEAD_BYTES;
    181  
     192
    182193    // We dont have that memory already. Allocate.
     194#ifdef VBOX_USE_IPRT_IN_XPCOM
     195    Block *ptr = (Block *) (zeroit ? RTMemAllocZ(allocBytes) : RTMemAlloc(allocBytes));
     196#else
    183197    Block *ptr = (Block *) (zeroit ? calloc(1, allocBytes) : malloc(allocBytes));
    184    
     198#endif
     199
    185200    // Deal with no memory situation
    186201    if (!ptr)
    187202        return ptr;
    188  
     203
    189204    // This is the first allocation we are holding.
    190205    // Setup timer for releasing memory
     
    194209    if (mRecycleAfter && !mRecycleTimer)
    195210    {
    196         // known only to stuff in xpcom. 
     211        // known only to stuff in xpcom.
    197212        extern nsresult NS_NewTimer(nsITimer* *aResult, nsTimerCallbackFunc aCallback, void *aClosure,
    198213                                    PRUint32 aDelay, PRUint32 aType);
    199214
    200         (void) NS_NewTimer(&mRecycleTimer, nsRecycleTimerCallback, this, 
     215        (void) NS_NewTimer(&mRecycleTimer, nsRecycleTimerCallback, this,
    201216                           NS_SEC_TO_MS(mRecycleAfter),
    202217                           nsITimer::TYPE_REPEATING_SLACK);
    203218        NS_ASSERTION(mRecycleTimer, "nsRecyclingAllocator: Creating timer failed.\n");
    204219    }
    205  
     220
    206221#ifdef DEBUG
    207222    mNAllocated++;
    208223#endif
    209  
     224
    210225    // Store size and return data portion
    211226    ptr->bytes = bytes;
     
    235250        mNAllocated--;
    236251#endif
     252#ifdef VBOX_USE_IPRT_IN_XPCOM
     253        RTMemFree(block);
     254#else
    237255        free(block);
     256#endif
    238257    }
    239258}
     
    257276    {
    258277        // Free the allocated block
     278#ifdef VBOX_USE_IPRT_IN_XPCOM
     279        RTMemFree(node->block);
     280#else
    259281        free(node->block);
     282#endif
    260283
    261284#ifdef DEBUG_dp
     
    275298    mFreeList = nsnull;
    276299
    277 #ifdef DEBUG       
     300#ifdef DEBUG
    278301    mNAllocated = 0;
    279302#endif
  • trunk/src/libs/xpcom18a4/xpcom/ds/pldhash.c

    r11278 r31259  
    5757# define METER(x)       /* nothing */
    5858#endif
     59#ifdef VBOX_USE_IPRT_IN_XPCOM
     60# include <iprt/mem.h>
     61#endif
    5962
    6063PR_IMPLEMENT(void *)
    6164PL_DHashAllocTable(PLDHashTable *table, PRUint32 nbytes)
    6265{
     66#ifdef VBOX_USE_IPRT_IN_XPCOM
     67    return RTMemAlloc(nbytes);
     68#else
    6369    return malloc(nbytes);
     70#endif
    6471}
    6572
     
    6774PL_DHashFreeTable(PLDHashTable *table, void *ptr)
    6875{
     76#ifdef VBOX_USE_IPRT_IN_XPCOM
     77    RTMemFree(ptr);
     78#else
    6979    free(ptr);
     80#endif
    7081}
    7182
     
    137148    const PLDHashEntryStub *stub = (const PLDHashEntryStub *)entry;
    138149
     150#ifdef VBOX_USE_IPRT_IN_XPCOM
     151    RTMemFree((void *) stub->key);
     152#else
    139153    free((void *) stub->key);
     154#endif
    140155    memset(entry, 0, table->entrySize);
    141156}
     
    170185    PLDHashTable *table;
    171186
     187#ifdef VBOX_USE_IPRT_IN_XPCOM
     188    table = (PLDHashTable *) RTMemAlloc(sizeof *table);
     189#else
    172190    table = (PLDHashTable *) malloc(sizeof *table);
     191#endif
    173192    if (!table)
    174193        return NULL;
    175194    if (!PL_DHashTableInit(table, ops, data, entrySize, capacity)) {
     195#ifdef VBOX_USE_IPRT_IN_XPCOM
     196        RTMemFree(table);
     197#else
    176198        free(table);
     199#endif
    177200        return NULL;
    178201    }
     
    184207{
    185208    PL_DHashTableFinish(table);
     209#ifdef VBOX_USE_IPRT_IN_XPCOM
     210    RTMemFree(table);
     211#else
    186212    free(table);
     213#endif
    187214}
    188215
  • trunk/src/libs/xpcom18a4/xpcom/proxy/src/nsProxyEvent.cpp

    r1 r31259  
    7676
    7777static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID);
    78        
     78
    7979static void* PR_CALLBACK EventHandler(PLEvent *self);
    8080static void  PR_CALLBACK DestroyHandler(PLEvent *self);
     
    8686nsProxyObjectCallInfo::nsProxyObjectCallInfo( nsProxyObject* owner,
    8787                                              nsXPTMethodInfo *methodInfo,
    88                                               PRUint32 methodIndex, 
    89                                               nsXPTCVariant* parameterList, 
    90                                               PRUint32 parameterCount, 
     88                                              PRUint32 methodIndex,
     89                                              nsXPTCVariant* parameterList,
     90                                              PRUint32 parameterCount,
    9191                                              PLEvent *event)
    9292{
     
    9494    NS_ASSERTION(methodInfo, "No nsXPTMethodInfo!");
    9595    NS_ASSERTION(event, "No PLEvent!");
    96    
     96
    9797    mCompleted        = 0;
    9898    mMethodIndex      = methodIndex;
     
    104104
    105105    mOwner            = owner;
    106    
     106
    107107    RefCountInInterfacePointers(PR_TRUE);
    108108    if (mOwner->GetProxyType() & PROXY_ASYNC)
     
    118118
    119119    mOwner = nsnull;
    120    
     120
    121121    PR_FREEIF(mEvent);
    122    
    123     if (mParameterList) 
     122
     123    if (mParameterList)
     124#ifdef VBOX_USE_IPRT_IN_XPCOM
     125        nsMemory::Free((void*) mParameterList);
     126#else
    124127        free( (void*) mParameterList);
     128#endif
    125129}
    126130
     
    139143            {
    140144                anInterface = ((nsISupports*)mParameterList[i].val.p);
    141                
     145
    142146                if (anInterface)
    143147                {
     
    146150                    else
    147151                        anInterface->Release();
    148            
     152
    149153                }
    150154            }
     
    170174
    171175            if (copy)
    172             {               
    173                 switch (type_tag) 
     176            {
     177                switch (type_tag)
    174178                {
    175                     case nsXPTType::T_CHAR_STR:                               
     179                    case nsXPTType::T_CHAR_STR:
    176180                        mParameterList[i].val.p =
    177181                            PL_strdup((const char *)ptr);
     
    183187                    case nsXPTType::T_DOMSTRING:
    184188                    case nsXPTType::T_ASTRING:
    185                         mParameterList[i].val.p = 
     189                        mParameterList[i].val.p =
    186190                            new nsString(*((nsAString*) ptr));
    187191                        break;
    188192                    case nsXPTType::T_CSTRING:
    189                         mParameterList[i].val.p = 
     193                        mParameterList[i].val.p =
    190194                            new nsCString(*((nsACString*) ptr));
    191195                        break;
    192                     case nsXPTType::T_UTF8STRING:                       
    193                         mParameterList[i].val.p = 
     196                    case nsXPTType::T_UTF8STRING:
     197                        mParameterList[i].val.p =
    194198                            new nsUTF8String(*((nsAUTF8String*) ptr));
    195199                        break;
    196200                    default:
    197201                        // Other types are ignored
    198                         break;                   
     202                        break;
    199203                }
    200204            }
    201205            else
    202206            {
    203                 switch (type_tag) 
     207                switch (type_tag)
    204208                {
    205209                    case nsXPTType::T_CHAR_STR:
     
    226230}
    227231
    228 PRBool               
     232PRBool
    229233nsProxyObjectCallInfo::GetCompleted()
    230234{
     
    238242}
    239243
    240 void               
     244void
    241245nsProxyObjectCallInfo::PostCompleted()
    242246{
     
    244248    {
    245249        PLEvent *event = PR_NEW(PLEvent);
    246    
    247         PL_InitEvent(event, 
     250
     251        PL_InitEvent(event,
    248252                     this,
    249253                     CompletedEventHandler,
    250254                     CompletedDestroyHandler);
    251    
     255
    252256        mCallersEventQ->PostSynchronousEvent(event, nsnull);
    253257        PR_FREEIF(event);
     
    259263    }
    260264}
    261  
    262 nsIEventQueue*     
    263 nsProxyObjectCallInfo::GetCallersQueue() 
    264 { 
     265
     266nsIEventQueue*
     267nsProxyObjectCallInfo::GetCallersQueue()
     268{
    265269    return mCallersEventQ;
    266 }   
     270}
    267271void
    268272nsProxyObjectCallInfo::SetCallersQueue(nsIEventQueue* queue)
    269273{
    270274    mCallersEventQ = queue;
    271 }   
     275}
    272276
    273277
     
    286290    mEventQService = do_GetService(kEventQueueServiceCID);
    287291
    288     nsComponentManager::CreateInstance(aClass, 
     292    nsComponentManager::CreateInstance(aClass,
    289293                                       aDelegate,
    290294                                       aIID,
     
    296300
    297301nsProxyObject::~nsProxyObject()
    298 {   
    299     // I am worried about order of destruction here. 
     302{
     303    // I am worried about order of destruction here.
    300304    // do not remove assignments.
    301    
     305
    302306    mRealObject = 0;
    303307    mDestQueue  = 0;
     
    315319nsProxyObject::Release(void)
    316320{
    317   NS_PRECONDITION(0 != mRefCnt, "dup release");             
     321  NS_PRECONDITION(0 != mRefCnt, "dup release");
    318322
    319323  nsrefcnt count = PR_AtomicDecrement((PRInt32 *)&mRefCnt);
     
    343347           return;  // if this happens we are going to leak.
    344348       }
    345        
    346        PL_InitEvent(event, 
     349
     350       PL_InitEvent(event,
    347351                    this,
    348352                    ProxyDestructorEventHandler,
    349                     ProxyDestructorDestroyHandler); 
     353                    ProxyDestructorDestroyHandler);
    350354
    351355       mDestQueue->PostEvent(event);
    352   }                         
    353 }               
     356  }
     357}
    354358
    355359
     
    357361nsProxyObject::PostAndWait(nsProxyObjectCallInfo *proxyInfo)
    358362{
    359     if (proxyInfo == nsnull || mEventQService == nsnull) 
     363    if (proxyInfo == nsnull || mEventQService == nsnull)
    360364        return NS_ERROR_NULL_POINTER;
    361    
     365
    362366    PRBool eventLoopCreated = PR_FALSE;
    363     nsresult rv; 
     367    nsresult rv;
    364368
    365369    nsCOMPtr<nsIEventQueue> eventQ;
     
    371375        if (NS_FAILED(rv))
    372376            return rv;
    373        
     377
    374378        rv = mEventQService->GetThreadEventQueue(NS_CURRENT_THREAD, getter_AddRefs(eventQ));
    375379    }
     
    377381    if (NS_FAILED(rv))
    378382        return rv;
    379    
     383
    380384    proxyInfo->SetCallersQueue(eventQ);
    381385
     
    383387    if (!event)
    384388        return NS_ERROR_NULL_POINTER;
    385    
     389
    386390    mDestQueue->PostEvent(event);
    387391
     
    391395        rv = eventQ->WaitForEvent(&nextEvent);
    392396        if (NS_FAILED(rv)) break;
    393                
     397
    394398        eventQ->HandleEvent(nextEvent);
    395     } 
     399    }
    396400
    397401    if (eventLoopCreated)
     
    400404         eventQ = 0;
    401405    }
    402    
     406
    403407    return rv;
    404408}
    405        
    406        
     409
     410
    407411nsresult
    408 nsProxyObject::convertMiniVariantToVariant(nsXPTMethodInfo *methodInfo, 
    409                                            nsXPTCMiniVariant * params, 
    410                                            nsXPTCVariant **fullParam, 
     412nsProxyObject::convertMiniVariantToVariant(nsXPTMethodInfo *methodInfo,
     413                                           nsXPTCMiniVariant * params,
     414                                           nsXPTCVariant **fullParam,
    411415                                           uint8 *outParamCount)
    412416{
     
    416420
    417421    if (!paramCount) return NS_OK;
    418        
     422
     423#ifdef VBOX_USE_IPRT_IN_XPCOM
     424    *fullParam = (nsXPTCVariant*)nsMemory::Alloc(sizeof(nsXPTCVariant) * paramCount);
     425#else
    419426    *fullParam = (nsXPTCVariant*)malloc(sizeof(nsXPTCVariant) * paramCount);
    420    
     427#endif
     428
    421429    if (*fullParam == nsnull)
    422430        return NS_ERROR_OUT_OF_MEMORY;
    423    
     431
    424432    for (int i = 0; i < paramCount; i++)
    425433    {
     
    427435        if ((mProxyType & PROXY_ASYNC) && paramInfo.IsDipper())
    428436        {
    429             NS_WARNING("Async proxying of out parameters is not supported"); 
     437            NS_WARNING("Async proxying of out parameters is not supported");
    430438            return NS_ERROR_PROXY_INVALID_OUT_PARAMETER;
    431439        }
     
    433441        (*fullParam)[i].Init(params[i], paramInfo.GetType(), flags);
    434442    }
    435    
     443
    436444    return NS_OK;
    437445}
    438        
     446
    439447nsresult
    440 nsProxyObject::Post( PRUint32 methodIndex, 
    441                      nsXPTMethodInfo *methodInfo, 
    442                      nsXPTCMiniVariant * params, 
    443                      nsIInterfaceInfo *interfaceInfo)           
    444 {
    445     nsresult rv = NS_OK; 
     448nsProxyObject::Post( PRUint32 methodIndex,
     449                     nsXPTMethodInfo *methodInfo,
     450                     nsXPTCMiniVariant * params,
     451                     nsIInterfaceInfo *interfaceInfo)
     452{
     453    nsresult rv = NS_OK;
    446454
    447455    if (! mDestQueue  || ! mRealObject)
     
    450458    if (methodInfo->IsNotXPCOM())
    451459        return NS_ERROR_PROXY_INVALID_IN_PARAMETER;
    452    
     460
    453461    nsXPTCVariant *fullParam;
    454     uint8 paramCount; 
     462    uint8 paramCount;
    455463    rv = convertMiniVariantToVariant(methodInfo, params, &fullParam, &paramCount);
    456    
     464
    457465    if (NS_FAILED(rv))
    458466        return rv;
     
    462470    // see if we should call into the method directly. Either it is a QI function call
    463471    // (methodIndex == 0), or it is a sync proxy and this code is running on the same thread
    464     // as the destination event queue. 
     472    // as the destination event queue.
    465473    if ( (methodIndex == 0) ||
    466          (mProxyType & PROXY_SYNC && 
     474         (mProxyType & PROXY_SYNC &&
    467475          NS_SUCCEEDED(mDestQueue->IsOnCurrentThread(&callDirectly)) &&
    468476          callDirectly))
     
    470478
    471479        // invoke the magic of xptc...
    472         nsresult rv = XPTC_InvokeByIndex( mRealObject, 
     480        nsresult rv = XPTC_InvokeByIndex( mRealObject,
    473481                                          methodIndex,
    474                                           paramCount, 
     482                                          paramCount,
    475483                                          fullParam);
    476        
    477         if (fullParam)
     484
     485        if (fullParam)
     486#ifdef VBOX_USE_IPRT_IN_XPCOM
     487            nsMemory::Free(fullParam);
     488#else
    478489            free(fullParam);
     490#endif
    479491        return rv;
    480492    }
    481493
    482494    PLEvent *event = PR_NEW(PLEvent);
    483    
     495
    484496    if (event == nsnull) {
    485         if (fullParam)
     497        if (fullParam)
     498#ifdef VBOX_USE_IPRT_IN_XPCOM
     499            nsMemory::Free(fullParam);
     500#else
    486501            free(fullParam);
    487         return NS_ERROR_OUT_OF_MEMORY;   
    488     }
    489 
    490     nsProxyObjectCallInfo *proxyInfo = new nsProxyObjectCallInfo(this,
    491                                                                  methodInfo,
    492                                                                  methodIndex,
     502#endif
     503        return NS_ERROR_OUT_OF_MEMORY;
     504    }
     505
     506    nsProxyObjectCallInfo *proxyInfo = new nsProxyObjectCallInfo(this,
     507                                                                 methodInfo,
     508                                                                 methodIndex,
    493509                                                                 fullParam,   // will be deleted by ~()
    494                                                                  paramCount, 
     510                                                                 paramCount,
    495511                                                                 event);      // will be deleted by ~()
    496    
     512
    497513    if (proxyInfo == nsnull) {
    498514        PR_DELETE(event);
    499515        if (fullParam)
     516#ifdef VBOX_USE_IPRT_IN_XPCOM
     517            nsMemory::Free(fullParam);
     518#else
    500519            free(fullParam);
    501         return NS_ERROR_OUT_OF_MEMORY; 
    502     }
    503 
    504     PL_InitEvent(event,
     520#endif
     521        return NS_ERROR_OUT_OF_MEMORY;
     522    }
     523
     524    PL_InitEvent(event,
    505525                 proxyInfo,
    506526                 EventHandler,
    507527                 DestroyHandler);
    508    
     528
    509529    if (mProxyType & PROXY_SYNC)
    510530    {
    511531        rv = PostAndWait(proxyInfo);
    512        
     532
    513533        if (NS_SUCCEEDED(rv))
    514534            rv = proxyInfo->GetResult();
     
    516536        return rv;
    517537    }
    518    
     538
    519539    if (mProxyType & PROXY_ASYNC)
    520540    {
     
    527547
    528548
    529 static void DestroyHandler(PLEvent *self) 
     549static void DestroyHandler(PLEvent *self)
    530550{
    531551    nsProxyObjectCallInfo* owner = (nsProxyObjectCallInfo*)PL_GetEventOwner(self);
    532552    nsProxyObject* proxyObject = owner->GetProxyObject();
    533    
     553
    534554    if (proxyObject == nsnull)
    535555        return;
    536  
     556
    537557    if (proxyObject->GetProxyType() & PROXY_ASYNC)
    538     {       
     558    {
    539559        delete owner;
    540560    }
     
    546566}
    547567
    548 static void* EventHandler(PLEvent *self) 
     568static void* EventHandler(PLEvent *self)
    549569{
    550570    nsProxyObjectCallInfo *info = (nsProxyObjectCallInfo*)PL_GetEventOwner(self);
    551571    NS_ASSERTION(info, "No nsProxyObjectCallInfo!");
    552    
     572
    553573    nsProxyObject *proxyObject = info->GetProxyObject();
    554        
     574
    555575    if (proxyObject)
    556576    {
    557577        // invoke the magic of xptc...
    558         nsresult rv = XPTC_InvokeByIndex( proxyObject->GetRealObject(), 
     578        nsresult rv = XPTC_InvokeByIndex( proxyObject->GetRealObject(),
    559579                                          info->GetMethodIndex(),
    560                                           info->GetParameterCount(), 
     580                                          info->GetParameterCount(),
    561581                                          info->GetParameterList());
    562582        info->SetResult(rv);
     
    569589}
    570590
    571 static void CompletedDestroyHandler(PLEvent *self) 
    572 {
    573 }
    574 
    575 static void* CompletedEventHandler(PLEvent *self) 
     591static void CompletedDestroyHandler(PLEvent *self)
     592{
     593}
     594
     595static void* CompletedEventHandler(PLEvent *self)
    576596{
    577597    nsProxyObjectCallInfo* owner = (nsProxyObjectCallInfo*)PL_GetEventOwner(self);
     
    581601
    582602static void* ProxyDestructorEventHandler(PLEvent *self)
    583 {             
     603{
    584604    nsProxyObject* owner = (nsProxyObject*) PL_GetEventOwner(self);
    585605    NS_DELETEXPCOM(owner);
    586     return nsnull;                                           
     606    return nsnull;
    587607}
    588608
  • trunk/src/libs/xpcom18a4/xpcom/string/src/nsStringObsolete.cpp

    r1 r31259  
    5353#include "prdtoa.h"
    5454#include "prprf.h"
     55#ifdef VBOX_USE_IPRT_IN_XPCOM
     56# include <iprt/mem.h>
     57#endif
    5558
    5659/* ***** BEGIN RICKG BLOCK *****
     
    7982/**
    8083 *  This methods cans the given buffer for the given char
    81  * 
     84 *
    8285 *  @update  gess 02/17/00
    8386 *  @param   aDest is the buffer to be searched
     
    101104    //We'll only search if the given aChar is within the normal ascii a range,
    102105    //(Since this string is definitely within the ascii range).
    103    
     106
    104107    if(0<aCount) {
    105108
     
    111114      PRInt32 theMax = end-left;
    112115      if(0<theMax) {
    113        
     116
    114117        unsigned char theChar = (unsigned char) aChar;
    115118        const char* result=(const char*)memchr(left, (int)theChar, theMax);
    116        
     119
    117120        if(result)
    118121          return result-aDest;
    119        
     122
    120123      }
    121124    }
     
    128131/**
    129132 *  This methods cans the given buffer for the given char
    130  * 
     133 *
    131134 *  @update  gess 3/25/98
    132135 *  @param   aDest is the buffer to be searched
     
    147150
    148151  if((0<aDestLength) && ((PRUint32)anOffset < aDestLength)) {
    149  
     152
    150153    if(0<aCount) {
    151154
     
    157160
    158161      while(left<end){
    159        
     162
    160163        if(*left==aChar)
    161164          return (left-root);
    162        
     165
    163166        ++left;
    164167      }
     
    172175/**
    173176 *  This methods cans the given buffer (in reverse) for the given char
    174  * 
     177 *
    175178 *  @update  gess 02/17/00
    176179 *  @param   aDest is the buffer to be searched
     
    195198    //We'll only search if the given aChar is within the normal ascii a range,
    196199    //(Since this string is definitely within the ascii range).
    197  
     200
    198201    if(0 < aCount) {
    199202
    200       const char* rightmost = aDest + anOffset; 
     203      const char* rightmost = aDest + anOffset;
    201204      const char* min       = rightmost - aCount + 1;
    202205      const char* leftmost  = (min<aDest) ? aDest: min;
     
    204207      char theChar=(char)aChar;
    205208      while(leftmost <= rightmost){
    206        
     209
    207210        if((*rightmost) == theChar)
    208211          return rightmost - aDest;
    209        
     212
    210213        --rightmost;
    211214      }
     
    219222/**
    220223 *  This methods cans the given buffer for the given char
    221  * 
     224 *
    222225 *  @update  gess 3/25/98
    223226 *  @param   aDest is the buffer to be searched
     
    238241
    239242  if((0 < aDestLength) && ((PRUint32)anOffset < aDestLength)) {
    240  
     243
    241244    if(0 < aCount) {
    242245
    243246      const PRUnichar* root      = aDest;
    244       const PRUnichar* rightmost = root + anOffset; 
     247      const PRUnichar* rightmost = root + anOffset;
    245248      const PRUnichar* min       = rightmost - aCount + 1;
    246249      const PRUnichar* leftmost  = (min<root) ? root: min;
    247      
     250
    248251      while(leftmost <= rightmost){
    249        
     252
    250253        if((*rightmost) == aChar)
    251254          return rightmost - root;
    252        
     255
    253256        --rightmost;
    254257      }
     
    283286#endif /* __SUNPRO_CC */
    284287PRInt32
    285 Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){ 
     288Compare1To1(const char* aStr1,const char* aStr2,PRUint32 aCount,PRBool aIgnoreCase){
    286289  PRInt32 result=0;
    287290  if(aIgnoreCase)
    288291    result=PRInt32(PL_strncasecmp(aStr1, aStr2, aCount));
    289   else 
     292  else
    290293    result=nsCharTraits<char>::compare(aStr1,aStr2,aCount);
    291294
     
    308311 * @return  -1,0,1 depending on <,==,>
    309312 */
    310 static 
     313static
    311314#ifdef __SUNPRO_CC
    312315inline
     
    315318Compare2To2(const PRUnichar* aStr1,const PRUnichar* aStr2,PRUint32 aCount){
    316319  PRInt32 result;
    317  
     320
    318321  if ( aStr1 && aStr2 )
    319322    result = nsCharTraits<PRUnichar>::compare(aStr1, aStr2, aCount);
     
    356359  const PRUnichar* s1 = aStr1;
    357360  const char *s2 = aStr2;
    358  
     361
    359362  if (aStr1 && aStr2) {
    360363    if (aCount != 0) {
     
    363366        PRUnichar c1 = *s1++;
    364367        PRUnichar c2 = PRUnichar((unsigned char)*s2++);
    365        
     368
    366369        if (c1 != c2) {
    367370#ifdef NS_DEBUG
     
    379382              c1 = ascii_tolower(char(c1));
    380383              c2 = ascii_tolower(char(c2));
    381            
     384
    382385              if (c1 == c2) continue;
    383386          }
     
    415418
    416419/**
    417  * This method compresses duplicate runs of a given char from the given buffer 
     420 * This method compresses duplicate runs of a given char from the given buffer
    418421 *
    419422 * @update      rickg 03.23.2000
     
    426429 */
    427430static PRInt32
    428 CompressChars1(char* aString,PRUint32 aLength,const char* aSet){ 
     431CompressChars1(char* aString,PRUint32 aLength,const char* aSet){
    429432
    430433  char*  from = aString;
     
    439442    while (from < end) {
    440443      char theChar = *from++;
    441      
     444
    442445      *to++=theChar; //always copy this char...
    443446
     
    460463
    461464/**
    462  * This method compresses duplicate runs of a given char from the given buffer 
     465 * This method compresses duplicate runs of a given char from the given buffer
    463466 *
    464467 * @update      rickg 03.23.2000
     
    471474 */
    472475static PRInt32
    473 CompressChars2(PRUnichar* aString,PRUint32 aLength,const char* aSet){ 
     476CompressChars2(PRUnichar* aString,PRUint32 aLength,const char* aSet){
    474477
    475478  PRUnichar*  from = aString;
     
    484487    while (from < end) {
    485488      PRUnichar theChar = *from++;
    486      
     489
    487490      *to++=theChar; //always copy this char...
    488491
     
    503506
    504507/**
    505  * This method strips chars in a given set from the given buffer 
     508 * This method strips chars in a given set from the given buffer
    506509 *
    507510 * @update      gess 01/04/99
     
    514517 */
    515518static PRInt32
    516 StripChars1(char* aString,PRUint32 aLength,const char* aSet){ 
     519StripChars1(char* aString,PRUint32 aLength,const char* aSet){
    517520
    518521  // XXXdarin this code should defer writing until necessary.
     
    537540
    538541/**
    539  * This method strips chars in a given set from the given buffer 
     542 * This method strips chars in a given set from the given buffer
    540543 *
    541544 * @update      gess 01/04/99
     
    548551 */
    549552static PRInt32
    550 StripChars2(PRUnichar* aString,PRUint32 aLength,const char* aSet){ 
     553StripChars2(PRUnichar* aString,PRUint32 aLength,const char* aSet){
    551554
    552555  // XXXdarin this code should defer writing until necessary.
     
    560563    while (++from < end) {
    561564      PRUnichar theChar = *from;
    562       //Note the test for ascii range below. If you have a real unicode char, 
     565      //Note the test for ascii range below. If you have a real unicode char,
    563566      //and you're searching for chars in the (given) ascii string, there's no
    564567      //point in doing the real search since it's out of the ascii range.
     
    635638
    636639    static
    637     PRInt32 compress_chars( char* s, PRUint32 len, const char* set ) 
     640    PRInt32 compress_chars( char* s, PRUint32 len, const char* set )
    638641      {
    639642        return CompressChars1(s, len, set);
     
    688691
    689692    static
    690     PRInt32 compress_chars( PRUnichar* s, PRUint32 len, const char* set ) 
     693    PRInt32 compress_chars( PRUnichar* s, PRUint32 len, const char* set )
    691694      {
    692695        return CompressChars2(s, len, set);
     
    751754    CharT filter = nsBufferRoutines<CharT>::get_find_in_set_filter(set);
    752755
    753     const CharT* end = data + dataLen; 
     756    const CharT* end = data + dataLen;
    754757    for (const CharT* iter = data; iter < end; ++iter)
    755758      {
     
    807810 * XXXdarin if this is the right thing, then why wasn't it fixed in NSPR?!?
    808811 */
    809 void 
     812void
    810813Modified_cnvtf(char *buf, int bufsz, int prcsn, double fval)
    811814{
     
    816819
    817820  /* If anything fails, we store an empty string in 'buf' */
     821#ifdef VBOX_USE_IPRT_IN_XPCOM
     822  num = (char*)RTMemAlloc(bufsz);
     823#else
    818824  num = (char*)malloc(bufsz);
     825#endif
    819826  if (num == NULL) {
    820827    buf[0] = '\0';
     
    891898  }
    892899done:
     900#ifdef VBOX_USE_IPRT_IN_XPCOM
     901  RTMemFree(num);
     902#else
    893903  free(num);
     904#endif
    894905}
    895906
    896907  /**
    897908   * this method changes the meaning of |offset| and |count|:
    898    * 
     909   *
    899910   * upon return,
    900911   *   |offset| specifies start of search range
    901912   *   |count| specifies length of search range
    902    */ 
     913   */
    903914static void
    904915Find_ComputeSearchRange( PRUint32 bigLen, PRUint32 littleLen, PRInt32& offset, PRInt32& count )
     
    920931      {
    921932        count = maxCount;
    922       } 
     933      }
    923934    else
    924935      {
     
    935946   *   |offset| specifies the end point from which to search backwards
    936947   *   |count| specifies the number of iterations from |offset|
    937    * 
     948   *
    938949   * upon return,
    939950   *   |offset| specifies start of search range
     
    942953   *
    943954   * EXAMPLE
    944    * 
     955   *
    945956   *                            + -- littleLen=4 -- +
    946957   *                            :                   :
     
    952963   *   count = 7.
    953964   *
    954    */ 
     965   */
    955966static void
    956967RFind_ComputeSearchRange( PRUint32 bigLen, PRUint32 littleLen, PRInt32& offset, PRInt32& count )
     
    10351046    else if (aOffset >= PRInt32(mLength))
    10361047      return kNotFound;
    1037    
     1048
    10381049    PRInt32 result = ::FindCharInSet(mData + aOffset, mLength - aOffset, aSet);
    10391050    if (result != kNotFound)
  • trunk/src/libs/xpcom18a4/xpcom/string/src/nsSubstring.cpp

    r1 r31259  
    5151#include "nsMemory.h"
    5252#include "pratom.h"
     53#ifdef VBOX_USE_IPRT_IN_XPCOM
     54# include <iprt/mem.h>
     55#endif
    5356
    5457// ---------------------------------------------------------------------------
     
    7679            return;
    7780
     81#ifndef VBOX
    7882          printf("nsStringStats\n");
    7983          printf(" => mAllocCount:     % 10d\n", mAllocCount);
     
    9195          else
    9296            printf("\n");
     97#endif
    9398        }
    9499
     
    137142            {
    138143              STRING_STAT_INCREMENT(Free);
     144#ifdef VBOX_USE_IPRT_IN_XPCOM
     145              RTMemFree(this); // we were allocated with |malloc|
     146#else
    139147              free(this); // we were allocated with |malloc|
     148#endif
    140149            }
    141150        }
     
    147156        {
    148157          STRING_STAT_INCREMENT(Alloc);
    149  
     158
    150159          NS_ASSERTION(size != 0, "zero capacity allocation not allowed");
    151160
    152161          nsStringHeader *hdr =
     162#ifdef VBOX_USE_IPRT_IN_XPCOM
     163              (nsStringHeader *) RTMemAlloc(sizeof(nsStringHeader) + size);
     164#else
    153165              (nsStringHeader *) malloc(sizeof(nsStringHeader) + size);
     166#endif
    154167          if (hdr)
    155168            {
     
    169182          NS_ASSERTION(!hdr->IsReadonly(), "|Realloc| attempted on readonly string");
    170183
     184#ifdef VBOX_USE_IPRT_IN_XPCOM
     185          hdr = (nsStringHeader*) RTMemRealloc(hdr, sizeof(nsStringHeader) + size);
     186#else
    171187          hdr = (nsStringHeader*) realloc(hdr, sizeof(nsStringHeader) + size);
     188#endif
    172189          if (hdr)
    173190            hdr->mStorageSize = size;
  • trunk/src/libs/xpcom18a4/xpcom/threads/nsProcessCommon.cpp

    r1 r31259  
    3939
    4040/*****************************************************************************
    41  * 
     41 *
    4242 * nsProcess is used to execute new processes and specify if you want to
    4343 * wait (blocking) or continue (non-blocking).
     
    8989    mExecutable = executable;
    9090    //Get the path because it is needed by the NSPR process creation
    91 #ifdef XP_WIN 
     91#ifdef XP_WIN
    9292    rv = mExecutable->GetNativeTarget(mTargetPath);
    9393    if (NS_FAILED(rv) || mTargetPath.IsEmpty() )
     
    133133        /* Add a space to separates the arguments */
    134134        if (arg != argv) {
    135             *p++ = ' '; 
     135            *p++ = ' ';
    136136        }
    137137        q = *arg;
     
    196196            *p++ = '"';
    197197        }
    198     } 
     198    }
    199199
    200200    *p = '\0';
     
    204204
    205205// XXXldb |args| has the wrong const-ness
    206 NS_IMETHODIMP 
     206NS_IMETHODIMP
    207207nsProcess::Run(PRBool blocking, const char **args, PRUint32 count, PRUint32 *pid)
    208208{
     
    213213    // pass into PR_CreateProcess
    214214    char **my_argv = NULL;
     215#ifdef VBOX
     216    my_argv = (char **)nsMemory::Alloc(sizeof(char *) * (count + 2) );
     217#else
    215218    my_argv = (char **)malloc(sizeof(char *) * (count + 2) );
     219#endif
    216220    if (!my_argv) {
    217221        return NS_ERROR_OUT_OF_MEMORY;
     
    236240    if (assembleCmdLine(my_argv, &cmdLine) == -1) {
    237241        nsMemory::Free(my_argv);
    238         return NS_ERROR_FILE_EXECUTION_FAILED;   
     242        return NS_ERROR_FILE_EXECUTION_FAILED;
    239243    }
    240244
     
    258262    PR_FREEIF( cmdLine );
    259263    if (blocking) {
    260  
     264
    261265        // if success, wait for process termination. the early returns and such
    262         // are a bit ugly but preserving the logic of the nspr code I copied to 
     266        // are a bit ugly but preserving the logic of the nspr code I copied to
    263267        // minimize our risk abit.
    264268
     
    282286        else
    283287            rv = PR_FAILURE;
    284     } 
     288    }
    285289    else {
    286290
    287291        // map return value into success code
    288292
    289         if ( retVal == TRUE ) 
     293        if ( retVal == TRUE )
    290294            rv = PR_SUCCESS;
    291295        else
     
    347351    if (mProcess)
    348352        rv = PR_KillProcess(mProcess);
    349    
     353
    350354    return rv;
    351355}
     
    355359{
    356360    *aExitValue = mExitValue;
    357    
     361
    358362    return NS_OK;
    359363}
  • trunk/src/libs/xpcom18a4/xpcom/typelib/xpt/src/xpt_arena.c

    r1 r31259  
    4040/* XXX This exists because we don't want to drag in NSPR. It *seemed*
    4141*  to make more sense to write a quick and dirty arena than to clone
    42 *  plarena (like js/src did). This is not optimal, but it works. 
     42*  plarena (like js/src did). This is not optimal, but it works.
    4343*  Half of the code here is instrumentation.
    4444*/
     
    4848#include <stdio.h>
    4949#include <stdlib.h>
     50#ifdef VBOX_USE_IPRT_IN_XPCOM
     51# include <iprt/mem.h>
     52#endif
     53
    5054
    5155/*************************/
     
    9498#define LOG_FREE(_a)                  ((void)0)
    9599
    96 #define LOG_DONE_LOADING(_a)          ((void)0)       
     100#define LOG_DONE_LOADING(_a)          ((void)0)
    97101#define PRINT_STATS(_a)               ((void)0)
    98102
     
    137141XPT_NewArena(PRUint32 block_size, size_t alignment, const char* name)
    138142{
     143#ifdef VBOX_USE_IPRT_IN_XPCOM
     144    XPTArena *arena = RTMemAllocZ(sizeof(XPTArena));
     145#else
    139146    XPTArena *arena = calloc(1, sizeof(XPTArena));
     147#endif
    140148    if (arena) {
    141149        XPT_ASSERT(alignment);
     
    149157
    150158        /* must have room for at least one item! */
    151         XPT_ASSERT(arena->block_size >= 
     159        XPT_ASSERT(arena->block_size >=
    152160                   ALIGN_RND(sizeof(BLK_HDR), alignment) +
    153161                   ALIGN_RND(1, alignment));
    154162
    155163        if (name) {
    156             arena->name = XPT_STRDUP(arena, name);           
     164            arena->name = XPT_STRDUP(arena, name);
    157165#ifdef XPT_ARENA_LOGGING
    158166            /* fudge the stats since we are using space in the arena */
     
    163171        }
    164172    }
    165     return arena;       
     173    return arena;
    166174}
    167175
     
    171179    BLK_HDR* cur;
    172180    BLK_HDR* next;
    173        
     181
    174182    cur = arena->first;
    175183    while (cur) {
    176184        next = cur->next;
     185#ifdef VBOX_USE_IPRT_IN_XPCOM
     186        RTMemFree(cur);
     187#else
    177188        free(cur);
     189#endif
    178190        cur = next;
    179191    }
     192#ifdef VBOX_USE_IPRT_IN_XPCOM
     193    RTMemFree(arena);
     194#else
    180195    free(arena);
     196#endif
    181197}
    182198
     
    185201{
    186202    PRINT_STATS(arena);
    187 }       
    188 
    189 
    190 /* 
    191 * Our alignment rule is that we always round up the size of each allocation 
     203}
     204
     205
     206/*
     207* Our alignment rule is that we always round up the size of each allocation
    192208* so that the 'arena->next' pointer one will point to properly aligned space.
    193209*/
     
    208224
    209225    bytes = ALIGN_RND(size, arena->alignment);
    210    
     226
    211227    LOG_MALLOC(arena, size, bytes);
    212228
     
    215231        size_t block_header_size = ALIGN_RND(sizeof(BLK_HDR), arena->alignment);
    216232        size_t new_space = arena->block_size;
    217          
     233
    218234        if (bytes > new_space - block_header_size)
    219235            new_space += bytes;
    220236
    221         new_block = (BLK_HDR*) calloc(new_space/arena->alignment,
     237#ifdef VBOX_USE_IPRT_IN_XPCOM
     238        new_block = (BLK_HDR*) RTMemAllocZ(new_space/arena->alignment * (size_t)arena->alignment);
     239#else
     240        new_block = (BLK_HDR*) calloc(new_space/arena->alignment,
    222241                                      arena->alignment);
     242#endif
    223243        if (!new_block) {
    224244            arena->next = NULL;
     
    244264        memset(arena->next, 0xcd, arena->space);
    245265#endif
    246     } 
    247    
     266    }
     267
    248268#ifdef DEBUG
    249269    {
     
    251271        size_t i;
    252272        for (i = 0; i < bytes; ++i) {
    253             XPT_ASSERT(arena->next[i] == 0xcd);       
     273            XPT_ASSERT(arena->next[i] == 0xcd);
    254274        }
    255275        /* we guarantee that the block will be filled with zeros */
    256276        memset(arena->next, 0, bytes);
    257     }       
     277    }
    258278#endif
    259279
     
    261281    arena->next  += bytes;
    262282    arena->space -= bytes;
    263    
    264     return cur;   
     283
     284    return cur;
    265285}
    266286
     
    286306#ifdef XPT_ARENA_LOGGING
    287307    if (arena) {
    288         LOG_DONE_LOADING(arena);       
     308        LOG_DONE_LOADING(arena);
    289309    }
    290310#endif
     
    301321{
    302322    printf("()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\n");
    303     printf("Start xpt arena stats for \"%s\"\n", 
     323    printf("Start xpt arena stats for \"%s\"\n",
    304324            arena->name ? arena->name : "unnamed arena");
    305325    printf("\n");
    306     printf("%d times arena malloc called\n", (int) arena->LOG_MallocCallCount);       
    307     printf("%d total bytes requested from arena malloc\n", (int) arena->LOG_MallocTotalBytesRequested);       
     326    printf("%d times arena malloc called\n", (int) arena->LOG_MallocCallCount);
     327    printf("%d total bytes requested from arena malloc\n", (int) arena->LOG_MallocTotalBytesRequested);
    308328    printf("%d average bytes requested per call to arena malloc\n", (int)arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesRequested/arena->LOG_MallocCallCount) : 0);
    309329    printf("%d average bytes used per call (accounts for alignment overhead)\n", (int)arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesUsed/arena->LOG_MallocCallCount) : 0);
    310330    printf("%d average bytes used per call (accounts for all overhead and waste)\n", (int)arena->LOG_MallocCallCount ? (arena->LOG_RealMallocTotalBytesRequested/arena->LOG_MallocCallCount) : 0);
    311331    printf("\n");
    312     printf("%d during loading times arena free called\n", (int) arena->LOG_LoadingFreeCallCount);       
    313     printf("%d during loading approx total bytes not freed\n", (int) arena->LOG_LoadingFreeCallCount * (int) (arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesUsed/arena->LOG_MallocCallCount) : 0));       
    314     printf("\n");
    315     printf("%d total times arena free called\n", (int) arena->LOG_FreeCallCount);       
    316     printf("%d approx total bytes not freed until arena destruction\n", (int) arena->LOG_FreeCallCount * (int) (arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesUsed/arena->LOG_MallocCallCount) : 0 ));       
    317     printf("\n");
    318     printf("%d times arena called system malloc\n", (int) arena->LOG_RealMallocCallCount);       
    319     printf("%d total bytes arena requested from system\n", (int) arena->LOG_RealMallocTotalBytesRequested);       
    320     printf("%d byte block size specified at arena creation time\n", (int) arena->block_size);       
    321     printf("%d byte block alignment specified at arena creation time\n", (int) arena->alignment);       
     332    printf("%d during loading times arena free called\n", (int) arena->LOG_LoadingFreeCallCount);
     333    printf("%d during loading approx total bytes not freed\n", (int) arena->LOG_LoadingFreeCallCount * (int) (arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesUsed/arena->LOG_MallocCallCount) : 0));
     334    printf("\n");
     335    printf("%d total times arena free called\n", (int) arena->LOG_FreeCallCount);
     336    printf("%d approx total bytes not freed until arena destruction\n", (int) arena->LOG_FreeCallCount * (int) (arena->LOG_MallocCallCount ? (arena->LOG_MallocTotalBytesUsed/arena->LOG_MallocCallCount) : 0 ));
     337    printf("\n");
     338    printf("%d times arena called system malloc\n", (int) arena->LOG_RealMallocCallCount);
     339    printf("%d total bytes arena requested from system\n", (int) arena->LOG_RealMallocTotalBytesRequested);
     340    printf("%d byte block size specified at arena creation time\n", (int) arena->block_size);
     341    printf("%d byte block alignment specified at arena creation time\n", (int) arena->alignment);
    322342    printf("\n");
    323343    printf("End xpt arena stats\n");
    324344    printf("()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()\n");
    325 }       
     345}
    326346#endif
    327347
     
    335355            s, file, lineno);
    336356    abort();
    337 }       
    338 #endif
     357}
     358#endif
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