Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1297)

Unified Diff: webrtc/system_wrappers/source/aligned_malloc.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/system_wrappers/source/aligned_malloc.cc
diff --git a/webrtc/system_wrappers/source/aligned_malloc.cc b/webrtc/system_wrappers/source/aligned_malloc.cc
index f700f8b1f19f967b8345b5688e88e50299af1f3d..8fd852c06bdda4fb7d56d50fd55982dd6875c909 100644
--- a/webrtc/system_wrappers/source/aligned_malloc.cc
+++ b/webrtc/system_wrappers/source/aligned_malloc.cc
@@ -41,10 +41,10 @@ bool ValidAlignment(size_t alignment) {
void* GetRightAlign(const void* pointer, size_t alignment) {
if (!pointer) {
- return NULL;
+ return nullptr;
}
if (!ValidAlignment(alignment)) {
- return NULL;
+ return nullptr;
}
uintptr_t start_pos = reinterpret_cast<uintptr_t>(pointer);
return reinterpret_cast<void*>(GetRightAlign(start_pos, alignment));
@@ -52,10 +52,10 @@ void* GetRightAlign(const void* pointer, size_t alignment) {
void* AlignedMalloc(size_t size, size_t alignment) {
if (size == 0) {
- return NULL;
+ return nullptr;
}
if (!ValidAlignment(alignment)) {
- return NULL;
+ return nullptr;
}
// The memory is aligned towards the lowest address that so only
@@ -63,8 +63,8 @@ void* AlignedMalloc(size_t size, size_t alignment) {
// A pointer to the start of the memory must be stored so that it can be
// retreived for deletion, ergo the sizeof(uintptr_t).
void* memory_pointer = malloc(size + sizeof(uintptr_t) + alignment - 1);
- if (memory_pointer == NULL) {
- return NULL;
+ if (memory_pointer == nullptr) {
+ return nullptr;
}
// Aligning after the sizeof(uintptr_t) bytes will leave room for the header
@@ -85,7 +85,7 @@ void* AlignedMalloc(size_t size, size_t alignment) {
}
void AlignedFree(void* mem_block) {
- if (mem_block == NULL) {
+ if (mem_block == nullptr) {
return;
}
uintptr_t aligned_pos = reinterpret_cast<uintptr_t>(mem_block);

Powered by Google App Engine
This is Rietveld 408576698