VirtualBox

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


Ignore:
Timestamp:
Jul 30, 2010 8:02:05 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
64275
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/xpcom
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • 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