Core/MemoryHelper: Fix alloca with a size equivalent to zero
This commit is contained in:
parent
4b6d7d2e47
commit
1e53274623
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2017 Jérôme Leclercq
|
// Copyright (C) 2017 Jérôme Leclercq
|
||||||
// This file is part of the "Nazara Engine - Core module"
|
// This file is part of the "Nazara Engine - Core module"
|
||||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||||
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
// with MSVC, using alloca with a size of zero returns a valid pointer
|
||||||
#define NAZARA_ALLOCA(size) _alloca(size)
|
#define NAZARA_ALLOCA(size) _alloca(size)
|
||||||
#define NAZARA_ALLOCA_SUPPORT
|
#define NAZARA_ALLOCA_SUPPORT
|
||||||
|
|
||||||
|
|
@ -18,6 +19,8 @@
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
|
|
||||||
#define NAZARA_ALLOCA(size) alloca(size)
|
#define NAZARA_ALLOCA(size) alloca(size)
|
||||||
|
// with Clang/GCC, using alloca with a size of zero does nothing good
|
||||||
|
#define NAZARA_ALLOCA(size) alloca(((size) > 0) ? (size) : 1)
|
||||||
#define NAZARA_ALLOCA_SUPPORT
|
#define NAZARA_ALLOCA_SUPPORT
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue