Changeset 28271 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- Apr 13, 2010 7:29:42 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 60013
- Location:
- trunk/src/VBox/Runtime/common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/alloc/alloc.cpp
r26344 r28271 38 38 #include <iprt/assert.h> 39 39 #include <iprt/string.h> 40 41 #ifdef RTMEM_WRAP_TO_EF_APIS 42 # undef RTMemAllocVar 43 # undef RTMemAllocZVar 44 # undef RTMemDup 45 # undef RTMemDupEx 46 #endif 47 48 49 50 /** 51 * Wrapper around RTMemAlloc for automatically aligning variable sized 52 * allocations so that the various electric fence heaps works correctly. 53 * 54 * @returns See RTMemAlloc. 55 * @param cbUnaligned The unaligned size. 56 */ 57 RTDECL(void *) RTMemAllocVar(size_t cbUnaligned) 58 { 59 size_t cbAligned; 60 if (cbUnaligned >= 16) 61 cbAligned = RT_ALIGN_Z(cbUnaligned, 16); 62 else 63 cbAligned = RT_ALIGN_Z(cbUnaligned, sizeof(void *)); 64 return RTMemAlloc(cbAligned); 65 } 66 67 68 /** 69 * Wrapper around RTMemAllocZ for automatically aligning variable sized 70 * allocations so that the various electric fence heaps works correctly. 71 * 72 * @returns See RTMemAllocZ. 73 * @param cbUnaligned The unaligned size. 74 */ 75 RTDECL(void *) RTMemAllocZVar(size_t cbUnaligned) 76 { 77 size_t cbAligned; 78 if (cbUnaligned >= 16) 79 cbAligned = RT_ALIGN_Z(cbUnaligned, 16); 80 else 81 cbAligned = RT_ALIGN_Z(cbUnaligned, sizeof(void *)); 82 return RTMemAllocZ(cbAligned); 83 } 40 84 41 85 -
trunk/src/VBox/Runtime/common/log/log.cpp
r27807 r28271 276 276 */ 277 277 cb = RT_OFFSETOF(RTLOGGER, afGroups[cGroups + 1]) + RTPATH_MAX; 278 pLogger = (PRTLOGGER)RTMemAllocZ (cb);278 pLogger = (PRTLOGGER)RTMemAllocZVar(cb); 279 279 if (pLogger) 280 280 { -
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r28267 r28271 1072 1072 size_t const cbFile = pSrcPos->pszFile ? strlen(pSrcPos->pszFile) + 1 : 0; 1073 1073 size_t const cbFunction = pSrcPos->pszFile ? strlen(pSrcPos->pszFunction) + 1 : 0; 1074 RTLOCKVALCLASSINT *pThis = (RTLOCKVALCLASSINT *)RTMemAlloc (sizeof(*pThis) + cbFile + cbFunction + cbName);1074 RTLOCKVALCLASSINT *pThis = (RTLOCKVALCLASSINT *)RTMemAllocVar(sizeof(*pThis) + cbFile + cbFunction + cbName); 1075 1075 if (!pThis) 1076 1076 return VERR_NO_MEMORY;
Note:
See TracChangeset
for help on using the changeset viewer.