From d2766d0ff7604df7308a10e4fa4272f4d8a06e87 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 8 Nov 2008 18:58:01 +0100 Subject: [PATCH] Simplify user table closing. No need for an extra function for freeing the hash table. --- adu.c | 1 - user.c | 8 ++------ user.h | 1 - 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/adu.c b/adu.c index 657adb2..a586ade 100644 --- a/adu.c +++ b/adu.c @@ -119,7 +119,6 @@ void close_all_tables(void) { close_dir_table(); close_user_tables(); - free_hash_table(); } static void signal_handler(int s) diff --git a/user.c b/user.c index 1f7e04a..2b9fb20 100644 --- a/user.c +++ b/user.c @@ -298,12 +298,6 @@ void create_hash_table(unsigned bits) sizeof(struct user_info)); } -void free_hash_table(void) -{ - free(uid_hash_table); - uid_hash_table = NULL; -} - static int close_user_table(struct user_info *ui, __a_unused void *data) { int ret; @@ -328,6 +322,8 @@ static int close_user_table(struct user_info *ui, __a_unused void *data) void close_user_tables(void) { for_each_admissible_user(close_user_table, NULL); + free(uid_hash_table); + uid_hash_table = NULL; } /* diff --git a/user.h b/user.h index 0eba5bb..31f3a62 100644 --- a/user.h +++ b/user.h @@ -45,7 +45,6 @@ int write_uid_file(void); void create_hash_table(unsigned bits); void sort_hash_table(int (*comp)(const void *, const void *)); -void free_hash_table(void); int for_each_admissible_user(int (*func)(struct user_info *, void *), void *data); -- 2.39.2