| 4958 | } |
| 4959 | |
| 4960 | void *asCScriptEngine::CallAlloc(const asCObjectType *type) const |
| 4961 | { |
| 4962 | // Allocate 4 bytes as the smallest size. Otherwise CallSystemFunction may try to |
| 4963 | // copy a DWORD onto a smaller memory block, in case the object type is return in registers. |
| 4964 | |
| 4965 | // Pad to the next even 4 bytes to avoid asBC_CPY writing outside of allocated buffer for registered POD types |
| 4966 | asUINT size = type->size; |
| 4967 | if( size & 0x3 ) |
| 4968 | size += 4 - (size & 0x3); |
| 4969 | |
| 4970 | #ifndef WIP_16BYTE_ALIGN |
| 4971 | #if defined(AS_DEBUG) |
| 4972 | return ((asALLOCFUNCDEBUG_t)userAlloc)(size, __FILE__, __LINE__); |
| 4973 | #else |
| 4974 | return userAlloc(size); |
| 4975 | #endif |
| 4976 | #else |
| 4977 | #if defined(AS_DEBUG) |
| 4978 | return ((asALLOCALIGNEDFUNCDEBUG_t)userAllocAligned)(size, type->alignment, __FILE__, __LINE__); |
| 4979 | #else |
| 4980 | return userAllocAligned(size, type->alignment); |
| 4981 | #endif |
| 4982 | #endif |
| 4983 | } |
| 4984 | |
| 4985 | void asCScriptEngine::CallFree(void *obj) const |
| 4986 | { |
no outgoing calls
no test coverage detected