aboutsummaryrefslogtreecommitdiffstats
path: root/UsersTable.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
committerDaniel Lange <DLange@git.local>2020-12-07 10:26:01 +0100
commit65357c8c46154de4e4eca14075bfe5523bb5fc14 (patch)
tree8f430ee5a0d5de377c4e7c94e47842a27c70d7e8 /UsersTable.c
parentf80394a20254938142011855f2954b3f63fe5909 (diff)
downloaddebian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.gz
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.tar.bz2
debian_htop-65357c8c46154de4e4eca14075bfe5523bb5fc14.zip
New upstream version 3.0.3upstream/3.0.3
Diffstat (limited to 'UsersTable.c')
-rw-r--r--UsersTable.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/UsersTable.c b/UsersTable.c
index 86ed75c..fdbfd68 100644
--- a/UsersTable.c
+++ b/UsersTable.c
@@ -1,28 +1,26 @@
/*
htop - UsersTable.c
(C) 2004-2011 Hisham H. Muhammad
-Released under the GNU GPL, see the COPYING file
+Released under the GNU GPLv2, see the COPYING file
in the source distribution for its full text.
*/
-#include "UsersTable.h"
-#include "XAlloc.h"
+#include "config.h" // IWYU pragma: keep
-#include "config.h"
+#include "UsersTable.h"
-#include <stdio.h>
-#include <string.h>
-#include <strings.h>
#include <pwd.h>
-#include <sys/types.h>
+#include <stdbool.h>
+#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
+
+#include "XUtils.h"
UsersTable* UsersTable_new() {
UsersTable* this;
this = xMalloc(sizeof(UsersTable));
- this->users = Hashtable_new(20, true);
+ this->users = Hashtable_new(10, true);
return this;
}
@@ -32,9 +30,9 @@ void UsersTable_delete(UsersTable* this) {
}
char* UsersTable_getRef(UsersTable* this, unsigned int uid) {
- char* name = (char*) (Hashtable_get(this->users, uid));
+ char* name = Hashtable_get(this->users, uid);
if (name == NULL) {
- struct passwd* userData = getpwuid(uid);
+ const struct passwd* userData = getpwuid(uid);
if (userData != NULL) {
name = xStrdup(userData->pw_name);
Hashtable_put(this->users, uid, name);

© 2014-2024 Faster IT GmbH | imprint | privacy policy