diff options
author | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-18 01:05:12 +0000 |
---|---|---|
committer | cyberbotx <cyberbotx@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-11-18 01:05:12 +0000 |
commit | da8a1c7b6068dcc079d6f710a877ed53fabff86f (patch) | |
tree | 599684a3661fa346705d768568bf1e5d5b71f770 /src | |
parent | e10fe1cd767cf479837eecc1e1b26615d63ea5ac (diff) |
Remove some CoreExports and add them in other places, fixed a few minor warnings under Windows build, made Windows build create a static library out of win32_memory.cpp and use that with everything instead of relying on it being compiled into everything (saves compiling time).
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2656 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 17 | ||||
-rw-r--r-- | src/commands.c | 1 | ||||
-rw-r--r-- | src/core/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/mail.c | 1 | ||||
-rw-r--r-- | src/modules.c | 4 | ||||
-rw-r--r-- | src/modules/CMakeLists.txt | 18 | ||||
-rw-r--r-- | src/protocol/CMakeLists.txt | 9 | ||||
-rw-r--r-- | src/users.c | 2 | ||||
-rw-r--r-- | src/wildcard.cpp | 2 |
9 files changed, 34 insertions, 29 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9641a4ad2..a6343e8c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,10 +2,8 @@ file(GLOB SRC_SRCS_C RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.c") file(GLOB SRC_SRCS_CPP RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.cpp") set(SRC_SRCS ${SRC_SRCS_C} ${SRC_SRCS_CPP}) -# If not using Visual Studio, don't include win32_memory.cpp, it's only required by Visual Studio to override it's override of the new/delete operators -if(NOT MSVC) - remove_item_from_list(SRC_SRCS win32_memory.cpp) -endif(NOT MSVC) +# Don't include win32_memory.cpp, it's only required by Visual Studio to override it's override of the new/delete operators +remove_item_from_list(SRC_SRCS win32_memory.cpp) # If not using Windows, don't include windows.cpp, as it's Windows-specific if(NOT WIN32) remove_item_from_list(SRC_SRCS windows.cpp) @@ -54,12 +52,21 @@ if(WIN32) endif(MINGW) endif(WIN32) +# If compiling with Visual Studio, create a static library out of win32_memory.cpp to be included with everything else, needed to override it's override of new/delete operators +if(MSVC) + set_source_files_properties(win32_memory.cpp PROPERTIES LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + add_library(win32_memory STATIC win32_memory.cpp) + set(WIN32_MEMORY win32_memory) +else(MSVC) + set(WIN32_MEMORY) +endif(MSVC) + # Generate the Anope executable and set it's linker flags, also set it to export it's symbols even though it's not a module add_executable(${PROGRAM_NAME} ${SRC_SRCS}) set_target_properties(${PROGRAM_NAME} PROPERTIES LINKER_LANGUAGE CXX LINK_FLAGS "${LDFLAGS}" ENABLE_EXPORTS ON) # On Windows, also link Anope to the wsock32 library, as well as set the version if(WIN32) - target_link_libraries(${PROGRAM_NAME} wsock32) + target_link_libraries(${PROGRAM_NAME} wsock32 ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") endif(WIN32) # Building the Anope executable requires the language files to be compiled first as well as the version.h header to be generated diff --git a/src/commands.c b/src/commands.c index 6398a9b76..22e9fb8de 100644 --- a/src/commands.c +++ b/src/commands.c @@ -35,7 +35,6 @@ Command *lookup_cmd(Command * list, char *cmd) return c; } } - return NULL; } /*************************************************************************/ diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 7aa474743..f8547872b 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -27,10 +27,11 @@ foreach(SRC ${CORE_SRCS}) if(TEMP_INCLUDES) append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES}) endif(TEMP_INCLUDES) - # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators + # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) - append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp) - set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + set(WIN32_MEMORY win32_memory) + else(MSVC) + set(WIN32_MEMORY) endif(MSVC) # Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${SRC}) @@ -38,7 +39,7 @@ foreach(SRC ${CORE_SRCS}) add_dependencies(${SO} ${PROGRAM_NAME}) # For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version if(WIN32) - target_link_libraries(${SO} ${PROGRAM_NAME} wsock32) + target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") endif(WIN32) # Set the module to be installed to the module directory under the data directory diff --git a/src/mail.c b/src/mail.c index ea8ef65f6..e9d137bf9 100644 --- a/src/mail.c +++ b/src/mail.c @@ -164,7 +164,6 @@ MailInfo *MailMemoBegin(NickCore * nc) getstring(MEMO_MAIL_SUBJECT)); return mail; } - return NULL; } /*************************************************************************/ diff --git a/src/modules.c b/src/modules.c index 3482220ae..6a65da2eb 100644 --- a/src/modules.c +++ b/src/modules.c @@ -549,8 +549,6 @@ int delMessage(MessageHash * msgTable[], Message * m) current->m = tail->next; } return MOD_ERR_OK; - last = tail; - tail = tail->next; } } else { msgTable[index] = current->next; @@ -567,8 +565,6 @@ int delMessage(MessageHash * msgTable[], Message * m) current->m = tail->next; } return MOD_ERR_OK; - last = tail; - tail = tail->next; } } else { lastHash->next = current->next; diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index dbf9bbc97..79312cb8a 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -33,10 +33,11 @@ foreach(SRC ${MODULES_SRCS}) set(TEMP_DEPENDENCIES) # Calculate the library dependencies for the given source file calculate_libraries(${SRC} TEMP_LDFLAGS TEMP_DEPENDENCIES) - # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators + # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) - append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp) - set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + set(WIN32_MEMORY win32_memory) + else(MSVC) + set(WIN32_MEMORY) endif(MSVC) # Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${SRC}) @@ -44,7 +45,7 @@ foreach(SRC ${MODULES_SRCS}) add_dependencies(${SO} ${PROGRAM_NAME}) # For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version if(WIN32) - target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${TEMP_DEPENDENCIES}) + target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${TEMP_DEPENDENCIES}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") endif(WIN32) # Set the module to be installed to the module directory under the data directory @@ -113,10 +114,11 @@ foreach(FILE ${MODULES_FILES}) remove_list_duplicates(SUBDIR_EXTRA_DEPENDS) endif(SUBDIR_EXTRA_DEPENDS) - # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators + # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) - append_to_list(MODULE_SUBDIR_SRCS ${Anope_SOURCE_DIR}/src/win32_memory.cpp) - set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + set(WIN32_MEMORY win32_memory) + else(MSVC) + set(WIN32_MEMORY) endif(MSVC) # Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand @@ -125,7 +127,7 @@ foreach(FILE ${MODULES_FILES}) add_dependencies(${SO} ${PROGRAM_NAME}) # For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version if(WIN32) - target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${SUBDIR_EXTRA_DEPENDS}) + target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY} ${SUBDIR_EXTRA_DEPENDS}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") endif(WIN32) # Set the module to be installed to the module directory under the data directory diff --git a/src/protocol/CMakeLists.txt b/src/protocol/CMakeLists.txt index fda2a9d90..a74b49a89 100644 --- a/src/protocol/CMakeLists.txt +++ b/src/protocol/CMakeLists.txt @@ -27,10 +27,11 @@ foreach(SRC ${PROTOCOL_SRCS}) if(TEMP_INCLUDES) append_to_list(EXTRA_INCLUDES ${TEMP_INCLUDES}) endif(TEMP_INCLUDES) - # For Visual Studio only, include win32_memory.cpp to the list of sources, required to override Visual Studio's overrides of the new/delete operators + # For Visual Studio only, include win32_memory static library, required to override Visual Studio's overrides of the new/delete operators if(MSVC) - append_to_list(SRC ${Anope_SOURCE_DIR}/src/win32_memory.cpp) - set_source_files_properties(${Anope_SOURCE_DIR}/src/win32_memory.cpp LANGUAGE CXX COMPILE_FLAGS "${CXXFLAGS}") + set(WIN32_MEMORY win32_memory) + else(MSVC) + set(WIN32_MEMORY) endif(MSVC) # Generate the module and set it's linker flags, also set it to depend on the main Anope executable to be built beforehand add_library(${SO} MODULE ${SRC}) @@ -38,7 +39,7 @@ foreach(SRC ${PROTOCOL_SRCS}) add_dependencies(${SO} ${PROGRAM_NAME}) # For Windows only, have the module link to the export library of Anope as well as the wsock32 library (most of the modules probably don't need this, but this is to be on the safe side), also set it's version if(WIN32) - target_link_libraries(${SO} ${PROGRAM_NAME} wsock32) + target_link_libraries(${SO} ${PROGRAM_NAME} wsock32 ${WIN32_MEMORY}) set_target_properties(${PROGRAM_NAME} PROPERTIES VERSION "${VERSION_DOTTED}") endif(WIN32) # Set the module to be installed to the module directory under the data directory diff --git a/src/users.c b/src/users.c index a54506f8c..bfc6131bf 100644 --- a/src/users.c +++ b/src/users.c @@ -341,7 +341,7 @@ void User::SendMessage(const char *source, const std::string &msg) */ void User::CheckAuthenticationToken(const char *svid) { - const char *c; + const char *c = NULL; NickAlias *na; if ((na = findnick(this->nick))) diff --git a/src/wildcard.cpp b/src/wildcard.cpp index 59f2cc8e7..1106a9cd6 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -75,7 +75,7 @@ static bool match_internal(const unsigned char *str, const unsigned char *mask, return !*wild; } -CoreExport bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive) +bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive) { return match_internal(reinterpret_cast<const unsigned char *>(str.c_str()), reinterpret_cast<const unsigned char *>(mask.c_str()), case_sensitive); } |