]> git.tuebingen.mpg.de Git - adu.git/blobdiff - user.c
Merge branch 'master' into bloom
[adu.git] / user.c
diff --git a/user.c b/user.c
index bde47a7e79b87cc50d5813361d13cfc86746f272..026d65be741fdc3a100c24f6cce379f8eaa124e0 100644 (file)
--- a/user.c
+++ b/user.c
@@ -52,9 +52,6 @@ static struct user_info *uid_hash_table;
 /** This is always a power of two. It is set in create_hash_table(). */
 static uint32_t uid_hash_table_size;
 
 /** This is always a power of two. It is set in create_hash_table(). */
 static uint32_t uid_hash_table_size;
 
-/* Array of indices to the entries of \a uid_hash_table. */
-static int *uid_hash_table_sort_idx;
-
 /** The number of used slots in the hash table. */
 static uint32_t num_uids;
 
 /** The number of used slots in the hash table. */
 static uint32_t num_uids;
 
@@ -325,8 +322,7 @@ int for_each_admissible_user(int (*func)(struct user_info *, void *),
        assert(uid_hash_table);
        for (i = 0; i < uid_hash_table_size; i++) {
                int ret;
        assert(uid_hash_table);
        for (i = 0; i < uid_hash_table_size; i++) {
                int ret;
-               struct user_info *ui = uid_hash_table +
-                       uid_hash_table_sort_idx[i];
+               struct user_info *ui = uid_hash_table + i;
 
                if (!ui_used(ui) || !ui_admissible(ui))
                        continue;
 
                if (!ui_used(ui) || !ui_admissible(ui))
                        continue;
@@ -349,14 +345,9 @@ int for_each_admissible_user(int (*func)(struct user_info *, void *),
  */
 void create_hash_table(unsigned bits)
 {
  */
 void create_hash_table(unsigned bits)
 {
-       int i;
-
        uid_hash_table_size = 1 << bits;
        uid_hash_table = adu_calloc(uid_hash_table_size *
                sizeof(struct user_info));
        uid_hash_table_size = 1 << bits;
        uid_hash_table = adu_calloc(uid_hash_table_size *
                sizeof(struct user_info));
-       uid_hash_table_sort_idx = adu_malloc(uid_hash_table_size * sizeof(int));
-       for (i = 0; i < uid_hash_table_size; i++)
-               uid_hash_table_sort_idx[i] = i;
 }
 
 /**
 }
 
 /**
@@ -394,8 +385,6 @@ void close_user_tables(void)
        }
        free(uid_hash_table);
        uid_hash_table = NULL;
        }
        free(uid_hash_table);
        uid_hash_table = NULL;
-       free(uid_hash_table_sort_idx);
-       uid_hash_table_sort_idx = NULL;
 }
 
 /*
 }
 
 /*
@@ -465,32 +454,6 @@ static char *get_uid_list_name(void)
 {
        return make_message("%s/uid_list", conf.database_dir_arg);
 }
 {
        return make_message("%s/uid_list", conf.database_dir_arg);
 }
-
-static int (*hash_table_comparator)(struct user_info *a, struct user_info *b);
-
-static int comp_wrapper(const void *a, const void *b)
-{
-       struct user_info *x = uid_hash_table + *(unsigned *)a;
-       struct user_info *y = uid_hash_table + *(unsigned *)b;
-       return hash_table_comparator(x, y);
-}
-
-/**
- * Sort the hash table according to a given comparator.
- *
- * \param comp The comparator.
- *
- * The comparator is a user-defined function which must return 1, 0, or -1.
- *
- * \sa qsort(3).
- */
-void sort_hash_table(int (*comp)(struct user_info *, struct user_info *))
-{
-       hash_table_comparator = comp;
-       qsort(uid_hash_table_sort_idx, uid_hash_table_size,
-               sizeof(*uid_hash_table_sort_idx), comp_wrapper);
-}
-
 /**
  * Open the osl tables for all admissible uids.
  *
 /**
  * Open the osl tables for all admissible uids.
  *