Kouhei Sutou
null+****@clear*****
Sun Nov 17 22:15:48 JST 2013
Kouhei Sutou 2013-11-17 22:15:48 +0900 (Sun, 17 Nov 2013) New Revision: c4b16ed9d95af9bbf8ac2244ebb8e80b7cc8d0b2 https://github.com/mroonga/mroonga/commit/c4b16ed9d95af9bbf8ac2244ebb8e80b7cc8d0b2 Message: Move version check to hpp from cpp We should check MySQL version and define logical flags in hpp and use them in cpp. It improves maintenability. Some flags are used in two or more locations. If they are used in two or more locations, we need to write the same version check conditions there. It reduces maintenability: Not good: #if MYSQL_VERSION_ID >= 50607 // code1 #endif // ... #if MYSQL_VERSION_ID >= 50607 // code2 #endif Better: #if MYSQL_VERSION_ID >= 50607 # define LOGICAL_FLAG #endif #ifdef LOGICAL_FLAG // code1 #endif // ... #ifdef LOGICAL_FLAG // code2 #endif Modified files: ha_mroonga.cpp ha_mroonga.hpp Modified: ha_mroonga.cpp (+1 -1) =================================================================== --- ha_mroonga.cpp 2013-11-17 22:10:44 +0900 (8af3168) +++ ha_mroonga.cpp 2013-11-17 22:15:48 +0900 (1e6083b) @@ -3809,7 +3809,7 @@ int ha_mroonga::wrapper_open(const char *name, int mode, uint test_if_locked) DBUG_RETURN(HA_ERR_OUT_OF_MEM); } wrap_handler->init(); -#if MYSQL_VERSION_ID >= 50600 +#ifdef MRN_HANDLER_HAVE_SET_HA_SHARE_REF wrap_handler->set_ha_share_ref(&table->s->ha_share); #endif error = wrap_handler->ha_open(table, name, mode, test_if_locked); Modified: ha_mroonga.hpp (+4 -0) =================================================================== --- ha_mroonga.hpp 2013-11-17 22:10:44 +0900 (e3aa303) +++ ha_mroonga.hpp 2013-11-17 22:15:48 +0900 (8797f1c) @@ -91,6 +91,10 @@ extern "C" { # define MRN_HANDLER_HAVE_GET_TABLESPACE_NAME #endif +#if MYSQL_VERSION_ID >= 50607 +# define MRN_HANDLER_HAVE_SET_HA_SHARE_REF +#endif + #if MYSQL_VERSION_ID >= 50500 # define MRN_TABLE_LIST_INIT_REQUIRE_ALIAS #endif -------------- next part -------------- HTML����������������������������...下载