Compile statistics, thread, users and util as C++

This commit is contained in:
Johan Wikman 2017-03-24 11:05:55 +02:00
parent b5c44be4c8
commit b04e8b93c9
5 changed files with 10 additions and 5 deletions

View File

@ -31,7 +31,12 @@ add_library(maxscale-common SHARED
service.cc
session.cc
spinlock.cc
thread.c users.c utils.c skygw_utils.cc statistics.c listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c)
thread.cc
users.cc
utils.cc
skygw_utils.cc
statistics.cc
listener.c ssl.c mysql_utils.c mysql_binlog.c modulecmd.c)
if(WITH_JEMALLOC)
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})

View File

@ -23,7 +23,7 @@
* @endverbatim
*/
#include <maxscale/statistics.h>
#include "maxscale/statistics.h"
#include <string.h>
#include <maxscale/alloc.h>
#include <maxscale/config.h>

View File

@ -37,7 +37,7 @@ USERS *users_alloc()
{
USERS *rval;
if ((rval = MXS_CALLOC(1, sizeof(USERS))) == NULL)
if ((rval = (USERS*)MXS_CALLOC(1, sizeof(USERS))) == NULL)
{
return NULL;
}
@ -90,7 +90,7 @@ const char *users_fetch(USERS *users, const char *user)
{
atomic_add(&users->stats.n_fetches, 1);
// TODO: Returning data from the hashtable is not threadsafe.
return hashtable_fetch(users->data, (char*)user);
return (const char*)hashtable_fetch(users->data, (char*)user);
}
int users_update(USERS *users, const char *user, const char *auth)
@ -118,7 +118,7 @@ void users_default_diagnostic(DCB *dcb, SERV_LISTENER *port)
if (iter)
{
dcb_printf(dcb, "User names: ");
char *sep = "";
const char *sep = "";
void *user;
while ((user = hashtable_next(iter)) != NULL)