Introduce mem_size() and New() and start using it.

This commit is contained in:
Markus F.X.J. Oberhumer
2016-09-20 15:24:07 +02:00
parent 8d433f2580
commit 44248f19b5
8 changed files with 102 additions and 65 deletions
+7
View File
@@ -34,6 +34,13 @@
//
**************************************************************************/
size_t mem_size (upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extra=0);
size_t mem_size_get_n(upx_uint64_t element_size, upx_uint64_t n);
bool mem_size_valid(upx_uint64_t element_size, upx_uint64_t n, upx_uint64_t extra=0);
#define New(type,n) new type [ mem_size_get_n(sizeof(type),n) ]
class MemBuffer
{
public: