Compile statistics, thread, users and util as C++
This commit is contained in:
@ -31,7 +31,12 @@ add_library(maxscale-common SHARED
|
|||||||
service.cc
|
service.cc
|
||||||
session.cc
|
session.cc
|
||||||
spinlock.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)
|
if(WITH_JEMALLOC)
|
||||||
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})
|
target_link_libraries(maxscale-common ${JEMALLOC_LIBRARIES})
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <maxscale/statistics.h>
|
#include "maxscale/statistics.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <maxscale/alloc.h>
|
#include <maxscale/alloc.h>
|
||||||
#include <maxscale/config.h>
|
#include <maxscale/config.h>
|
@ -37,7 +37,7 @@ USERS *users_alloc()
|
|||||||
{
|
{
|
||||||
USERS *rval;
|
USERS *rval;
|
||||||
|
|
||||||
if ((rval = MXS_CALLOC(1, sizeof(USERS))) == NULL)
|
if ((rval = (USERS*)MXS_CALLOC(1, sizeof(USERS))) == NULL)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ const char *users_fetch(USERS *users, const char *user)
|
|||||||
{
|
{
|
||||||
atomic_add(&users->stats.n_fetches, 1);
|
atomic_add(&users->stats.n_fetches, 1);
|
||||||
// TODO: Returning data from the hashtable is not threadsafe.
|
// 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)
|
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)
|
if (iter)
|
||||||
{
|
{
|
||||||
dcb_printf(dcb, "User names: ");
|
dcb_printf(dcb, "User names: ");
|
||||||
char *sep = "";
|
const char *sep = "";
|
||||||
void *user;
|
void *user;
|
||||||
|
|
||||||
while ((user = hashtable_next(iter)) != NULL)
|
while ((user = hashtable_next(iter)) != NULL)
|
Reference in New Issue
Block a user