diff options
author | Aaron Ball <nullspoon@oper.io> | 2023-06-09 17:06:28 -0600 |
---|---|---|
committer | Aaron Ball <nullspoon@oper.io> | 2023-06-09 17:13:16 -0600 |
commit | 53f56643a50c32746d95b730a839f2d7bdf36359 (patch) | |
tree | 2e42a8a3cfdd1a4b219c24126aa5d52904f498b7 | |
parent | 5ffcbc32ea71073604a2c007b5ba60ec587b812e (diff) | |
download | fd-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.
-rw-r--r-- | main.c | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -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) { |