From be8f5071fda3faf9f327a58894ccd6704eea1f27 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 27 Sep 2016 09:35:12 +0000 Subject: [PATCH 1/3] Fix broken compilation on buildbot --- include/ma_global.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/ma_global.h b/include/ma_global.h index efda3efcc..c3d0a6bd0 100644 --- a/include/ma_global.h +++ b/include/ma_global.h @@ -29,6 +29,9 @@ #define sleep(x) Sleep(1000*(x)) #ifdef _MSC_VER #define inline __inline +#if _MSC_VER < 1900 +#define snprintf _snprintf +#endif #endif #define STDCALL __stdcall #endif From 04c05ea0ce2dc42271fa5f4b1de8ad34f48bdb0c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 30 Sep 2016 13:54:04 +0000 Subject: [PATCH 2/3] Do not remove PROJECT() from MariaDB Connector/C, there is no need --- CMakeLists.txt | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index db2fdee04..daf85b794 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,18 +16,20 @@ IF(COMMAND CMAKE_POLICY) ENDFOREACH() ENDIF() -IF (NOT DEFINED CMAKE_PROJECT_NAME) - # Standalone project - PROJECT(mariadb-connector-c C) -ELSE() - # do not inherit include directories from the parent project - SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES) - FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNITTEST - WITH_DYNCOL WITH_EXTERNAL_ZLIB WITH_CURL WITH_SQLITE WITH_SSL - INSTALL_LAYOUT WITH_TEST_SRCPKG) - SET(${V} ${${OPT}${V}}) - ENDFOREACH() -ENDIF() + +PROJECT(mariadb-connector-c C) + +# Is C/C built as subproject? +get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY) + +# do not inherit include directories from the parent project +SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES) +FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNITTEST + WITH_DYNCOL WITH_EXTERNAL_ZLIB WITH_CURL WITH_SQLITE WITH_SSL + INSTALL_LAYOUT WITH_TEST_SRCPKG) + SET(${V} ${${OPT}${V}}) +ENDFOREACH() + SET(PACKAGE_STATUS_SUFFIX "alpha") @@ -104,6 +106,7 @@ IF(WIN32) INCLUDE(${CC_SOURCE_DIR}/cmake/version_info.cmake) ENDIF() +IF(NOT IS_SUBPROJECT) IF(MSVC) # Speedup system tests INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake) @@ -127,6 +130,7 @@ IF(MSVC) ENDFOREACH() ENDIF() ENDIF() +ENDIF(NOT IS_SUBPROJECT) # Disable dbug information for release builds SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF") From fcb8da5929be8801abf9d1eda1a8be5a3f0a753a Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 30 Sep 2016 17:40:58 +0000 Subject: [PATCH 3/3] MDEV-10357 my_context_continue() does not store current fiber on Windows --- libmariadb/ma_context.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/libmariadb/ma_context.c b/libmariadb/ma_context.c index f4e7258c0..68b356065 100644 --- a/libmariadb/ma_context.c +++ b/libmariadb/ma_context.c @@ -675,25 +675,16 @@ my_context_destroy(struct my_context *c) int my_context_spawn(struct my_context *c, void (*f)(void *), void *d) { - void *current_fiber; c->user_func= f; c->user_arg= d; - /* - This seems to be a common trick to run ConvertThreadToFiber() only on the - first occurence in a thread, in a way that works on multiple Windows - versions. - */ - current_fiber= GetCurrentFiber(); - if (current_fiber == NULL || current_fiber == (void *)0x1e00) - current_fiber= ConvertThreadToFiber(c); - c->app_fiber= current_fiber; - SwitchToFiber(c->lib_fiber); - return c->return_value; + return my_context_continue(c); } int my_context_continue(struct my_context *c) { + void *current_fiber= IsThreadAFiber() ? GetCurrentFiber() : ConvertThreadToFiber(c); + c->app_fiber= current_fiber; SwitchToFiber(c->lib_fiber); return c->return_value; }