diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-14 15:04:18 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-06-07 17:19:16 +0200 |
commit | b4ead572501179244aa036e7a590fa7536929f2b (patch) | |
tree | f1e706b221e78e294b3169965c005df768730203 /src/corelib/global/qmalloc.cpp | |
parent | 327bfdb671e0e263c6fb027133a54985a65194c4 (diff) |
Move away from using 0 as a pointer constant
Cleans up most of corelib to use nullptr or default enums
where appropriate.
Change-Id: Ifcaac14ecdaaee730f87f10941db3ce407d71ef9
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/global/qmalloc.cpp')
-rw-r--r-- | src/corelib/global/qmalloc.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/global/qmalloc.cpp b/src/corelib/global/qmalloc.cpp index 05676a0da2..b071c1df62 100644 --- a/src/corelib/global/qmalloc.cpp +++ b/src/corelib/global/qmalloc.cpp @@ -74,18 +74,18 @@ void *qRealloc(void *ptr, size_t size) void *qMallocAligned(size_t size, size_t alignment) { - return qReallocAligned(0, size, 0, alignment); + return qReallocAligned(nullptr, size, 0, alignment); } void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t alignment) { // fake an aligned allocation - void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : 0; + void *actualptr = oldptr ? static_cast<void **>(oldptr)[-1] : nullptr; if (alignment <= sizeof(void*)) { // special, fast case void **newptr = static_cast<void **>(realloc(actualptr, newsize + sizeof(void*))); if (!newptr) - return 0; + return nullptr; if (newptr == actualptr) { // realloc succeeded without reallocating return oldptr; @@ -105,7 +105,7 @@ void *qReallocAligned(void *oldptr, size_t newsize, size_t oldsize, size_t align void *real = realloc(actualptr, newsize + alignment); if (!real) - return 0; + return nullptr; quintptr faked = reinterpret_cast<quintptr>(real) + alignment; faked &= ~(alignment - 1); |