VirtualBox

Changeset 95800 in vbox


Ignore:
Timestamp:
Jul 25, 2022 12:25:45 PM (3 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
152522
Message:

iprt/nocrt/stdlib.h: Supply malloc and friends mapped to our RTMem functions when compiling 3rd-party libs (IPRT_NO_CRT_FOR_3RD_PARTY). bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/nocrt/stdlib.h

    r93115 r95800  
    3131
    3232#include <iprt/types.h>
     33#include <iprt/mem.h>
    3334
    3435RT_C_DECLS_BEGIN
    3536
     37#ifdef IPRT_NO_CRT_FOR_3RD_PARTY
     38
     39DECLINLINE(void *) RT_NOCRT(malloc)(size_t cb)
     40{
     41    return RTMemAlloc(cb);
     42}
     43
     44DECLINLINE(void *) RT_NOCRT(calloc)(size_t cItems, size_t cbItem)
     45{
     46    return RTMemAllocZ(cItems * cbItem); /* caller responsible for overflow issues. */
     47}
     48
     49DECLINLINE(void *) RT_NOCRT(realloc)(void *pvOld, size_t cbNew)
     50{
     51    return RTMemRealloc(pvOld, cbNew);
     52}
     53
     54DECLINLINE(void) RT_NOCRT(free)(void *pv)
     55{
     56    RTMemFree(pv);
     57}
     58
     59# if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
     60#  define malloc    RT_NOCRT(malloc)
     61#  define calloc    RT_NOCRT(calloc)
     62#  define realloc   RT_NOCRT(realloc)
     63#  define free      RT_NOCRT(free)
     64# endif
     65
     66#endif /* IPRT_NO_CRT_FOR_3RD_PARTY */
    3667
    3768RT_C_DECLS_END
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette