Wrap fx_memory code in namespace pdfium.

Avoid polluting the top level namespace internal.

Change-Id: Iec3a1556f698a1dc09e46037852867641830412a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/74375
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcrt/fx_memory.cpp b/core/fxcrt/fx_memory.cpp
index 183adde..0c3e73d 100644
--- a/core/fxcrt/fx_memory.cpp
+++ b/core/fxcrt/fx_memory.cpp
@@ -48,7 +48,7 @@
 }
 
 void* FXMEM_DefaultCalloc(size_t num_elems, size_t byte_size) {
-  return internal::Calloc(num_elems, byte_size);
+  return pdfium::internal::Calloc(num_elems, byte_size);
 }
 
 void* FXMEM_DefaultRealloc(void* pointer, size_t new_size) {
@@ -72,6 +72,7 @@
   abort();
 }
 
+namespace pdfium {
 namespace internal {
 
 void* Alloc(size_t num_members, size_t member_size) {
@@ -150,6 +151,7 @@
 }
 
 }  // namespace internal
+}  // namespace pdfium
 
 void FX_Free(void* ptr) {
   // TODO(palmer): Removing this check exposes crashes when PDFium callers
diff --git a/core/fxcrt/fx_memory.h b/core/fxcrt/fx_memory.h
index 31d7d9e..3312191 100644
--- a/core/fxcrt/fx_memory.h
+++ b/core/fxcrt/fx_memory.h
@@ -39,25 +39,26 @@
 
 // These never return nullptr, and must return cleared memory.
 #define FX_Alloc(type, size) \
-  static_cast<type*>(internal::CallocOrDie(size, sizeof(type)))
+  static_cast<type*>(pdfium::internal::CallocOrDie(size, sizeof(type)))
 #define FX_Alloc2D(type, w, h) \
-  static_cast<type*>(internal::CallocOrDie2D(w, h, sizeof(type)))
+  static_cast<type*>(pdfium::internal::CallocOrDie2D(w, h, sizeof(type)))
 #define FX_Realloc(type, ptr, size) \
-  static_cast<type*>(internal::ReallocOrDie(ptr, size, sizeof(type)))
+  static_cast<type*>(pdfium::internal::ReallocOrDie(ptr, size, sizeof(type)))
 
 // May return nullptr, but returns cleared memory otherwise.
 #define FX_TryAlloc(type, size) \
-  static_cast<type*>(internal::Calloc(size, sizeof(type)))
+  static_cast<type*>(pdfium::internal::Calloc(size, sizeof(type)))
 #define FX_TryRealloc(type, ptr, size) \
-  static_cast<type*>(internal::Realloc(ptr, size, sizeof(type)))
+  static_cast<type*>(pdfium::internal::Realloc(ptr, size, sizeof(type)))
 
 // These never return nullptr, but return uninitialized memory.
 // TOOD(thestig): Add FX_TryAllocUninit() if there is a use case.
 #define FX_AllocUninit(type, size) \
-  static_cast<type*>(internal::AllocOrDie(size, sizeof(type)))
+  static_cast<type*>(pdfium::internal::AllocOrDie(size, sizeof(type)))
 #define FX_AllocUninit2D(type, w, h) \
-  static_cast<type*>(internal::AllocOrDie2D(w, h, sizeof(type)))
+  static_cast<type*>(pdfium::internal::AllocOrDie2D(w, h, sizeof(type)))
 
+namespace pdfium {
 namespace internal {
 
 void* Alloc(size_t num_members, size_t member_size);
@@ -71,6 +72,7 @@
 void* ReallocOrDie(void* ptr, size_t num_members, size_t member_size);
 
 }  // namespace internal
+}  // namespace pdfium
 
 void FX_Free(void* ptr);