This commit is contained in:
VilhoRaatikka
2014-10-23 18:58:36 +03:00
8 changed files with 3712 additions and 5 deletions

View File

@ -11,7 +11,7 @@ add_executable(test_service testservice.c)
add_executable(test_server testserver.c)
add_executable(test_users testusers.c)
add_executable(test_adminusers testadminusers.c)
target_link_libraries(test_mysql_users fullcore MySQLClient)
target_link_libraries(test_mysql_users MySQLClient fullcore)
target_link_libraries(test_hash fullcore)
target_link_libraries(test_hint fullcore)
target_link_libraries(test_spinlock fullcore)

View File

@ -42,6 +42,13 @@ testhash: testhash.c
-I$(ROOT_PATH)/utils \
testhash.c ../hashtable.o ../atomic.o ../spinlock.o -o testhash
testmysqlusers: test_mysql_users.c
$(CC) $(CFLAGS) \
-I$(ROOT_PATH)/server/include \
-I$(ROOT_PATH)/utils \
test_mysql_users.c ../hashtable.o ../atomic.o ../modutil.o ../spinlock.o -o testmysqlusers
testspinlock: testspinlock.c
$(CC) $(CFLAGS) \
-I$(ROOT_PATH)/server/include \

View File

@ -106,6 +106,8 @@ int add;
/**
* Delete a user from the user table.
*
* The last user in the table can not be deleted
*
* @param users The users table
* @param user The user name
* @return The number of users deleted from the table
@ -115,12 +117,12 @@ users_delete(USERS *users, char *user)
{
int del;
atomic_add(&users->stats.n_deletes, 1);
if (users->stats.n_entries == 1) {
return 0;
}
atomic_add(&users->stats.n_deletes, 1);
del = hashtable_delete(users->data, user);
atomic_add(&users->stats.n_entries, del * -1);
atomic_add(&users->stats.n_entries, -del);
return del;
}

View File

@ -29,7 +29,7 @@ UTILSPATH := $(ROOT_PATH)/utils
CC=cc
CFLAGS=-c -fPIC -I/usr/include -I../include -I../../include -I$(LOGPATH) \
-I$(UTILSPATH) -Wall -g
-I$(UTILSPATH) -I$(MYSQL_HEADERS) -Wall -g
include ../../../makefile.inc