]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - user_list.c
simplify lookup_user()
[paraslash.git] / user_list.c
index b7d739c130fc08d5d69c159be3c46d927f894df2..c6d45ca5f4b2846f7f5a6350a8e84b3c551539a7 100644 (file)
@@ -122,19 +122,18 @@ void init_user_list(char *user_list_file)
 /**
  * lookup user in user_list.
  *
- * \param user: must initially contain the name of the user and is filled
- * in by this function on success.
+ * \param name of the user
  *
- * \return 1 on success and < 0 on errors.
+ * \return a pointer to the corresponding user struct if the user was found,
+ *  \p NULL otherwise.
  */
-int lookup_user(struct user *user)
+struct user *lookup_user(const char *name)
 {
        struct user *u;
        list_for_each_entry(u, &user_list, node) {
-               if (strcmp(u->name, user->name))
+               if (strcmp(u->name, name))
                        continue;
-               *user = *u;
-               return 1;
+               return u;
        }
-       return -E_BAD_USER;
+       return NULL;
 }