[libcxx-commits] [libcxx] r358588 - [libc++][NFC] Make size of allocation more self-documenting

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Apr 17 09:11:41 PDT 2019


Author: ldionne
Date: Wed Apr 17 09:11:41 2019
New Revision: 358588

URL: http://llvm.org/viewvc/llvm-project?rev=358588&view=rev
Log:
[libc++][NFC] Make size of allocation more self-documenting

Modified:
    libcxx/trunk/src/debug.cpp

Modified: libcxx/trunk/src/debug.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/debug.cpp?rev=358588&r1=358587&r2=358588&view=diff
==============================================================================
--- libcxx/trunk/src/debug.cpp (original)
+++ libcxx/trunk/src/debug.cpp Wed Apr 17 09:11:41 2019
@@ -171,7 +171,7 @@ __libcpp_db::__insert_c(void* __c, __lib
     if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
     {
         size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
-        __c_node** cbeg = static_cast<__c_node**>(calloc(nc, sizeof(void*)));
+        __c_node** cbeg = static_cast<__c_node**>(calloc(nc, sizeof(__c_node*)));
         if (cbeg == nullptr)
             __throw_bad_alloc();
 
@@ -508,7 +508,7 @@ __libcpp_db::__insert_iterator(void* __i
     if (__isz_ + 1 > static_cast<size_t>(__iend_ - __ibeg_))
     {
         size_t nc = __next_prime(2*static_cast<size_t>(__iend_ - __ibeg_) + 1);
-        __i_node** ibeg = static_cast<__i_node**>(calloc(nc, sizeof(void*)));
+        __i_node** ibeg = static_cast<__i_node**>(calloc(nc, sizeof(__i_node*)));
         if (ibeg == nullptr)
             __throw_bad_alloc();
 




More information about the libcxx-commits mailing list