summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2023-06-09 17:06:28 -0600
committerAaron Ball <nullspoon@oper.io>2023-06-09 17:13:16 -0600
commit53f56643a50c32746d95b730a839f2d7bdf36359 (patch)
tree2e42a8a3cfdd1a4b219c24126aa5d52904f498b7 /main.c
parent5ffcbc32ea71073604a2c007b5ba60ec587b812e (diff)
downloadfd-enum-53f56643a50c32746d95b730a839f2d7bdf36359.tar.gz
fd-enum-53f56643a50c32746d95b730a839f2d7bdf36359.tar.xz
Simplify initialization of config struct
Just memset the whole range to 0 rather than initializing each member.
Diffstat (limited to 'main.c')
-rw-r--r--main.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/main.c b/main.c
index 7a9f526..487809e 100644
--- a/main.c
+++ b/main.c
@@ -74,19 +74,11 @@ long fgetsize(char* path) {
}
int parse_args(int argc, char* argv[], struct config* c) {
- // Initialize config struct
- c->pid = -1;
- c->dead = 0;
- c->truncate_dead = 0;
- c->live = 0;
- c->sockets = 0;
- c->pipes = 0;
- c->inodes = 0;
- c->showstats = 1;
- c->showsizefd = 0;
- c->showsizedead = 0;
- c->showsizelive = 0;
int i = 1;
+ // Initialize config struct to all 0
+ memset(c, 0, sizeof(struct config));
+ c->pid = -1; // Default to an impossible pid
+ c->showstats = 1; // Default to showing stats
while(i < argc) {
if(strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--dead") == 0) {

Generated by cgit