=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/top/Attic/username.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- src/usr.bin/top/Attic/username.c 2008/04/02 16:41:24 1.15 +++ src/usr.bin/top/Attic/username.c 2009/07/22 15:27:52 1.16 @@ -1,4 +1,4 @@ -/* $OpenBSD: username.c,v 1.15 2008/04/02 16:41:24 deraadt Exp $ */ +/* $OpenBSD: username.c,v 1.16 2009/07/22 15:27:52 deraadt Exp $ */ /* * Top users/processes display for Unix @@ -61,7 +61,7 @@ char name[_PW_NAME_LEN + 1]; }; -static int enter_user(uid_t, char *, int); +static int enter_user(uid_t, char *); static int get_user(uid_t); #define is_empty_hash(x) (hash_table[x].name[0] == 0) @@ -99,29 +99,24 @@ return ((uid_t)-1); /* enter the result in the hash table */ - enter_user(pwd->pw_uid, username, 1); + enter_user(pwd->pw_uid, username); /* return our result */ return (pwd->pw_uid); } -/* - * wecare: 1 = enter it always, 0 = nice to have - */ static int -enter_user(uid_t uid, char *name, int wecare) +enter_user(uid_t uid, char *name) { int hashindex; #ifdef DEBUG - fprintf(stderr, "enter_hash(%u, %s, %d)\n", uid, name, wecare); + fprintf(stderr, "enter_hash(%u, %s)\n", uid, name); #endif hashindex = hashit(uid); if (!is_empty_hash(hashindex)) { - if (!wecare) - return 0; /* Don't clobber a slot for trash */ if (hash_table[hashindex].uid == uid) return (hashindex); /* Fortuitous find */ } @@ -142,8 +137,8 @@ /* no performance penalty for using getpwuid makes it easy */ if ((pwd = getpwuid(uid)) != NULL) - return (enter_user(pwd->pw_uid, pwd->pw_name, 1)); + return (enter_user(pwd->pw_uid, pwd->pw_name)); /* if we can't find the name at all, then use the uid as the name */ - return (enter_user(uid, format_uid(uid), 1)); + return (enter_user(uid, format_uid(uid))); }