From 17b328cb9a65e4af67604beb97523551ed7c5ba3 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Fri, 21 Feb 2014 17:08:27 +0100 Subject: [PATCH] Added USERS_HASHTABLE_SIZE Added USERS_HASHTABLE_SIZE, default size is 52 --- server/core/dbusers.c | 10 +++++----- server/core/users.c | 2 +- server/include/users.h | 3 +++ 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/server/core/dbusers.c b/server/core/dbusers.c index fb7f4f302..832c684f9 100644 --- a/server/core/dbusers.c +++ b/server/core/dbusers.c @@ -228,7 +228,7 @@ getUsers(SERVICE *service, struct users *users) if(key.user == NULL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, - "%lu [getUsers()] strdup() failed for user %s\n", + "%lu [getUsers()] strdup() failed for user %s", pthread_self(), row[0]))); @@ -243,7 +243,7 @@ getUsers(SERVICE *service, struct users *users) if (mysql_users_add(users, &key, strlen(row[2]) ? row[2]+1 : row[2])) { LOGIF(LD, (skygw_log_write_flush( LOGFILE_DEBUG, - "%lu [mysql_users_add()] Added user %s@%s(%s)\n", + "%lu [mysql_users_add()] Added user %s@%s(%s)", pthread_self(), row[0], row[1], @@ -253,7 +253,7 @@ getUsers(SERVICE *service, struct users *users) } else { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, - "%lu [mysql_users_add()] Failed adding user user %s@%s(%s)\n", + "%lu [mysql_users_add()] Failed adding user %s@%s(%s)", pthread_self(), row[0], row[1], @@ -266,7 +266,7 @@ getUsers(SERVICE *service, struct users *users) /* setipaddress() failed, skip user add and log this*/ LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, - "%lu [getUsers()] setipaddress failed: user NOT added %s@%s\n", + "%lu [getUsers()] setipaddress failed: user %s@%s not added", pthread_self(), row[0], row[1]))); @@ -292,7 +292,7 @@ USERS *rval; if ((rval = calloc(1, sizeof(USERS))) == NULL) return NULL; - if ((rval->data = hashtable_alloc(52, uh_hfun, uh_cmpfun)) == NULL) { + if ((rval->data = hashtable_alloc(USERS_HASHTABLE_SIZE, uh_hfun, uh_cmpfun)) == NULL) { free(rval); return NULL; } diff --git a/server/core/users.c b/server/core/users.c index 80ef61a1e..eea12edca 100644 --- a/server/core/users.c +++ b/server/core/users.c @@ -61,7 +61,7 @@ USERS *rval; if ((rval = calloc(1, sizeof(USERS))) == NULL) return NULL; - if ((rval->data = hashtable_alloc(52, user_hash, strcmp)) == NULL) + if ((rval->data = hashtable_alloc(USERS_HASHTABLE_SIZE, user_hash, strcmp)) == NULL) { free(rval); return NULL; diff --git a/server/include/users.h b/server/include/users.h index 4969774c3..6b730224c 100644 --- a/server/include/users.h +++ b/server/include/users.h @@ -30,10 +30,13 @@ * Date Who Description * 23/06/13 Mark Riddoch Initial implementation * 14/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine + * 21/02/14 Massimiliano Pinto Added USERS_HASHTABLE_SIZE * * @endverbatim */ +#define USERS_HASHTABLE_SIZE 52 + /** * The users table statistics structure */