• Philipp A. Hartmann's avatar
    Avoid calling memcpy with NULL pointers · 0c5c1538
    Philipp A. Hartmann authored
    According to the C/C++ standards, calling `memcpy(NULL, NULL, 0)` is
    undefined behaviour. Recent GCC versions may rely on this by optimizing
    NULL pointer checks more aggressively, see [1].
    
    This patch tries to avoid calling std::memcpy with zero elements.
    As a side effect, explicitly return NULL when requesting an empty block
    from MemoryPoolAllocator::Malloc.
    
    This may be related to #301.
    
    [1] https://gcc.gnu.org/gcc-4.9/porting_to.html
    0c5c1538
Name
Last commit
Last update
CMakeModules Loading commit data...
bin Loading commit data...
doc Loading commit data...
example Loading commit data...
include/rapidjson Loading commit data...
test Loading commit data...
thirdparty Loading commit data...
.gitignore Loading commit data...
.gitmodules Loading commit data...
.travis.yml Loading commit data...
CMakeLists.txt Loading commit data...
RapidJSON.pc.in Loading commit data...
RapidJSONConfig.cmake.in Loading commit data...
RapidJSONConfigVersion.cmake.in Loading commit data...
appveyor.yml Loading commit data...
license.txt Loading commit data...
readme.md Loading commit data...
readme.zh-cn.md Loading commit data...
travis-doxygen.sh Loading commit data...