Moved get_libdir function to its own file.

This commit is contained in:
Markus Makela 2015-04-27 11:06:11 +03:00
parent 2fce114483
commit 0cfcad55da
4 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,5 @@
if(BUILD_TESTS OR BUILD_TOOLS)
add_library(fullcore STATIC adminusers.c atomic.c config.c buffer.c dbusers.c dcb.c filter.c gwbitmask.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c memlog.c modutil.c monitor.c poll.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c)
add_library(fullcore STATIC adminusers.c atomic.c config.c buffer.c dbusers.c dcb.c filter.c gwbitmask.c gw_utils.c hashtable.c hint.c housekeeper.c load_utils.c memlog.c modutil.c monitor.c poll.c resultset.c secrets.c server.c service.c session.c spinlock.c thread.c users.c utils.c gwdirs.c)
if(WITH_JEMALLOC)
target_link_libraries(fullcore ${JEMALLOC_LIBRARIES})
elseif(WITH_TCMALLOC)
@ -12,7 +12,7 @@ add_executable(maxscale atomic.c buffer.c spinlock.c gateway.c
gw_utils.c utils.c dcb.c load_utils.c session.c service.c server.c
poll.c config.c users.c hashtable.c dbusers.c thread.c gwbitmask.c
monitor.c adminusers.c secrets.c filter.c modutil.c hint.c
housekeeper.c memlog.c resultset.c)
housekeeper.c memlog.c resultset.c gwdirs.c)
if(WITH_JEMALLOC)
target_link_libraries(maxscale ${JEMALLOC_LIBRARIES})

View File

@ -129,11 +129,7 @@ static bool datadir_defined = false; /*< If the datadir was already set */
/* The data directory we created for this gateway instance */
static char pidfile[PATH_MAX+1] = "";
static char* configdir = NULL;
static char* logdir = NULL;
static char* libdir = NULL;
static char* cachedir = NULL;
static char* langdir = NULL;
/**
* exit flag for log flusher.
*/
@ -200,14 +196,7 @@ static bool resolve_maxscale_homedir(
static char* check_dir_access(char* dirname,bool,bool);
/**
* Get the directory with all the modules.
* @return The module directory
*/
char* get_libdir()
{
return libdir;
}
/**
* Handler for SIGHUP signal. Reload the configuration for the
* gateway.

10
server/core/gwdirs.c Normal file
View File

@ -0,0 +1,10 @@
#include <gwdirs.h>
/**
* Get the directory with all the modules.
* @return The module directory
*/
char* get_libdir()
{
return libdir?libdir:(char*)default_libdir;
}

View File

@ -19,6 +19,8 @@
* Copyright MariaDB Corporation Ab 2015
*/
#include <stdlib.h>
/** Default file locations, configured by CMake */
static const char* default_cnf_fname = "MaxScale.cnf";
static const char* default_configdir = "/etc/";
@ -30,4 +32,12 @@ static const char* default_cachedir = "/var/cache/maxscale/";
static const char* default_langdir = "/usr/share/mysql/english/"; /*< This is where the MariaDB
* server installs errmsg.sys */
static char* configdir = NULL;
static char* logdir = NULL;
static char* libdir = NULL;
static char* cachedir = NULL;
static char* langdir = NULL;
char* get_libdir();
#endif