Added USERS_HASHTABLE_SIZE

Added USERS_HASHTABLE_SIZE,  default size is 52
This commit is contained in:
MassimilianoPinto
2014-02-21 17:08:27 +01:00
parent 8d0f893bb8
commit 17b328cb9a
3 changed files with 9 additions and 6 deletions

View File

@ -228,7 +228,7 @@ getUsers(SERVICE *service, struct users *users)
if(key.user == NULL) { if(key.user == NULL) {
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"%lu [getUsers()] strdup() failed for user %s\n", "%lu [getUsers()] strdup() failed for user %s",
pthread_self(), pthread_self(),
row[0]))); 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])) { if (mysql_users_add(users, &key, strlen(row[2]) ? row[2]+1 : row[2])) {
LOGIF(LD, (skygw_log_write_flush( LOGIF(LD, (skygw_log_write_flush(
LOGFILE_DEBUG, LOGFILE_DEBUG,
"%lu [mysql_users_add()] Added user %s@%s(%s)\n", "%lu [mysql_users_add()] Added user %s@%s(%s)",
pthread_self(), pthread_self(),
row[0], row[0],
row[1], row[1],
@ -253,7 +253,7 @@ getUsers(SERVICE *service, struct users *users)
} else { } else {
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, 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(), pthread_self(),
row[0], row[0],
row[1], row[1],
@ -266,7 +266,7 @@ getUsers(SERVICE *service, struct users *users)
/* setipaddress() failed, skip user add and log this*/ /* setipaddress() failed, skip user add and log this*/
LOGIF(LE, (skygw_log_write_flush( LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR, LOGFILE_ERROR,
"%lu [getUsers()] setipaddress failed: user NOT added %s@%s\n", "%lu [getUsers()] setipaddress failed: user %s@%s not added",
pthread_self(), pthread_self(),
row[0], row[0],
row[1]))); row[1])));
@ -292,7 +292,7 @@ USERS *rval;
if ((rval = calloc(1, sizeof(USERS))) == NULL) if ((rval = calloc(1, sizeof(USERS))) == NULL)
return 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); free(rval);
return NULL; return NULL;
} }

View File

@ -61,7 +61,7 @@ USERS *rval;
if ((rval = calloc(1, sizeof(USERS))) == NULL) if ((rval = calloc(1, sizeof(USERS))) == NULL)
return 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); free(rval);
return NULL; return NULL;

View File

@ -30,10 +30,13 @@
* Date Who Description * Date Who Description
* 23/06/13 Mark Riddoch Initial implementation * 23/06/13 Mark Riddoch Initial implementation
* 14/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine * 14/02/14 Massimiliano Pinto Added usersCustomUserFormat, optional username format routine
* 21/02/14 Massimiliano Pinto Added USERS_HASHTABLE_SIZE
* *
* @endverbatim * @endverbatim
*/ */
#define USERS_HASHTABLE_SIZE 52
/** /**
* The users table statistics structure * The users table statistics structure
*/ */