]> git.tue.mpg.de Git - paraslash.git/commitdiff
server: Initialize user list at compile time.
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 12 Aug 2017 23:05:22 +0000 (01:05 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Mar 2018 02:28:10 +0000 (03:28 +0100)
This allows the removal of the "initialized" variable, and it
simplifies user_list_init().

user_list.c

index c9d265e55af7cdcddcb03fcb8dbfaeba86a92906..8c54ab7f78cc150a236d7231283d3b5279d9e3fc 100644 (file)
@@ -13,7 +13,7 @@
 #include "list.h"
 #include "user_list.h"
 
-static struct list_head user_list;
+INITIALIZED_LIST_HEAD(user_list);
 
 /*
  * Fill the list of users known to para_server.
@@ -104,18 +104,13 @@ err:
 void user_list_init(char *user_list_file)
 {
        struct user *u, *tmp;
-       static int initialized;
 
-       if (initialized) {
-               list_for_each_entry_safe(u, tmp, &user_list, node) {
-                       list_del(&u->node);
-                       free(u->name);
-                       free_public_key(u->pubkey);
-                       free(u);
-               }
-       } else
-               INIT_LIST_HEAD(&user_list);
-       initialized = 1;
+       list_for_each_entry_safe(u, tmp, &user_list, node) {
+               list_del(&u->node);
+               free(u->name);
+               free_public_key(u->pubkey);
+               free(u);
+       }
        populate(user_list_file);
 }