Code cleanup to make it look less hacky.

Liny 2012-11-02 13:43:29 -07:00
parent 560af49ba9
commit 2aef3d85cf
10 changed files with 36 additions and 41 deletions

View File

@ -109,6 +109,7 @@ set(llcommon_SOURCE_FILES
timing.cpp
u64.cpp
ndintrin.cpp
ndallocators.cpp
ndmemorypool.cpp
)
@ -266,6 +267,7 @@ set(llcommon_HEADER_FILES
timer.h
timing.h
u64.h
ndallocators.h
ndmemorypool.h
ndintrin.h
ndlocks.h
@ -277,10 +279,6 @@ set_source_files_properties(${llcommon_HEADER_FILES}
list(APPEND llcommon_SOURCE_FILES ${llcommon_HEADER_FILES})
if(WINDOWS)
list(APPEND llcommon_SOURCE_FILES ndallocators.cpp)
endif(WINDOWS)
if(LLCOMMON_LINK_SHARED)
add_library (llcommon SHARED ${llcommon_SOURCE_FILES})
if(WINDOWS)

View File

@ -27,27 +27,7 @@
#define LLMEMORY_H
#include "llmemtype.h"
namespace ndAllocators
{
#ifdef ND_USE_ND_ALLOCS
void *ndMalloc( size_t aSize, size_t aAlign );
void ndFree( void* ptr );
void *ndRealloc( void *ptr, size_t aSize, size_t aAlign );
#else
inline void *ndMalloc( size_t aSize, size_t aAlign )
{
return malloc( aSize );
}
inline void ndFree( void* ptr )
{
return free( ptr );
}
void *ndRealloc( void *ptr, size_t aSize, size_t aAlign )
{
return realloc( ptr, aSize );
}
#endif
}
#include "ndallocators.h"
#if LL_DEBUG
inline void* ll_aligned_malloc( size_t size, int align )

View File

@ -26,7 +26,7 @@
#include <new>
#include <stdlib.h>
#include <stdint.h>
#include "ndmemorypool.h"
#include "ndallocators.h"
#ifdef ND_USE_ND_ALLOCS

View File

@ -23,9 +23,35 @@
*/
// Yes, that a hack :(
// MSVC really complains badly if you do not compiler the pch header into every source files that uses it.
// Usage of pch could be disabled for ../llcommon/ndallocators in newview/CMakeLists.txt, but that's even more magic
// that needs to be merged when upstream changes CMakeLists.txt
#include "llviewerprecompiledheaders.h"
#include "../llcommon/ndallocators.cpp"
#ifndef NdAllocators_H
#define NdAllocators_H
#include <new>
#include <stdlib.h>
#include <stdint.h>
#include "ndmemorypool.h"
namespace ndAllocators
{
#ifdef ND_USE_ND_ALLOCS
void *ndMalloc( size_t aSize, size_t aAlign );
void ndFree( void* ptr );
void *ndRealloc( void *ptr, size_t aSize, size_t aAlign );
#else
inline void *ndMalloc( size_t aSize, size_t aAlign )
{
return malloc( aSize );
}
inline void ndFree( void* ptr )
{
return free( ptr );
}
void *ndRealloc( void *ptr, size_t aSize, size_t aAlign )
{
return realloc( ptr, aSize );
}
#endif
}
#endif //NdAllocators_H

View File

@ -24,7 +24,6 @@ endif (DARWIN)
set(SLPlugin_SOURCE_FILES
slplugin.cpp
../../llcommon/ndallocators.cpp
)
if (DARWIN)

View File

@ -42,7 +42,6 @@ set(media_plugin_gstreamer010_SOURCE_FILES
media_plugin_gstreamer010.cpp
llmediaimplgstreamer_syms.cpp
llmediaimplgstreamervidplug.cpp
../../llcommon/ndallocators.cpp
)
set(media_plugin_gstreamer010_HEADER_FILES

View File

@ -35,7 +35,6 @@ endif (DARWIN)
set(media_plugin_quicktime_SOURCE_FILES
media_plugin_quicktime.cpp
../../llcommon/ndallocators.cpp
)
add_library(media_plugin_quicktime

View File

@ -43,7 +43,6 @@ endif(NOT WORD_SIZE EQUAL 32)
set(media_plugin_webkit_SOURCE_FILES
media_plugin_webkit.cpp
../../llcommon/ndallocators.cpp
)
set(media_plugin_webkit_HEADER_FILES

View File

@ -738,10 +738,6 @@ else (HAS_OPENSIM_SUPPORT)
)
endif (HAS_OPENSIM_SUPPORT)
if( ND_USE_ND_ALLOCS )
list(APPEND viewer_SOURCE_FILES ndallocators.cpp)
endif( ND_USE_ND_ALLOCS )
set(VIEWER_BINARY_NAME "firestorm-bin" CACHE STRING
"The name of the viewer executable to create.")

View File

@ -26,7 +26,6 @@ set(win_crash_logger_SOURCE_FILES
win_crash_logger.cpp
llcrashloggerwindows.cpp
llcrashlookupwindows.cpp
../llcommon/ndallocators.cpp
)
set(win_crash_logger_HEADER_FILES