VirtualBox

Changeset 101786 in vbox for trunk


Ignore:
Timestamp:
Nov 4, 2023 7:58:23 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
159882
Message:

libs/xpcom: Make PR_Malloc and friends inline helpers and get rid of prmem.c, bugref:10545

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

Legend:

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

    r101785 r101786  
    526526        nsprpub/pr/src/io/prstdio.c \
    527527        nsprpub/pr/src/linking/prlink.c \
    528         nsprpub/pr/src/malloc/prmem.c \
    529528        nsprpub/pr/src/md/prosdep.c \
    530529        nsprpub/pr/src/memory/prseg.c \
  • trunk/src/libs/xpcom18a4/nsprpub/pr/include/prmem.h

    r11551 r101786  
    4747#include <stddef.h>
    4848#include <stdlib.h>
     49#include <iprt/mem.h>
    4950
    5051#ifdef VBOX_WITH_XPCOM_NAMESPACE_CLEANUP
     
    6465*/
    6566
    66 /*
    67 ** PR_Malloc, PR_Calloc, PR_Realloc, and PR_Free have the same signatures
    68 ** as their libc equivalent malloc, calloc, realloc, and free, and have
    69 ** the same semantics.  (Note that the argument type size_t is replaced
    70 ** by PRUint32.)  Memory allocated by PR_Malloc, PR_Calloc, or PR_Realloc
    71 ** must be freed by PR_Free.
    72 */
     67#ifdef VBOX
     68DECL_FORCE_INLINE(void *) PR_Malloc(PRUint32 size)
     69{
     70    return RTMemAlloc(RT_MAX(size, 1));
     71}
    7372
    74 NSPR_API(void *) PR_Malloc(PRUint32 size);
     73DECL_FORCE_INLINE(void *) PR_Calloc(PRUint32 nelem, PRUint32 elsize)
     74{
     75    return RTMemAllocZ(RT_MAX(nelem * (size_t)elsize, 1));
     76}
    7577
    76 NSPR_API(void *) PR_Calloc(PRUint32 nelem, PRUint32 elsize);
     78DECL_FORCE_INLINE(void *) PR_Realloc(void *ptr, PRUint32 size)
     79{
     80    return RTMemRealloc(ptr, size);
     81}
    7782
    78 NSPR_API(void *) PR_Realloc(void *ptr, PRUint32 size);
    79 
    80 NSPR_API(void) PR_Free(void *ptr);
     83DECL_FORCE_INLINE(void) PR_Free(void *ptr)
     84{
     85    RTMemFree(ptr);
     86}
     87#else
     88# error "Not supported"
     89#endif
    8190
    8291/*
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