commit 97049080a945e564b80d1a8c51173ed1fb45e22c from: Alexander Arkhipov date: Sun Aug 21 15:49:28 2022 UTC simplify the code commit - 6c402b5967201469340cc2b7de0e07c2449eff7a commit + 97049080a945e564b80d1a8c51173ed1fb45e22c blob - 0f859db3b6f051a67c7c9ae9ffbb75fa76d01dac blob + d029531700282a908e6b9331bf7d3e2f4ac17cf1 --- gpass.c +++ gpass.c @@ -46,7 +46,7 @@ gen(void) return; } for (char c = getc(fp); c != EOF; c = getc(fp)) - nlines = (c == '\n') ? nlines + 1 : nlines; + nlines += (c == '\n'); int plen = minent / log2(nlines) + 1; if (plen > nlines) { @@ -74,7 +74,7 @@ gen(void) nlines = 0; } } - nlines += (c == '\n' || c == EOF || c == '\0') ? 1 : 0; + nlines += (c == '\n' || c == EOF || c == '\0'); } putchar('\n'); fclose(fp); @@ -113,8 +113,8 @@ main(int argc, char *argv[]) usage(); } } - dict = dict ? dict : getenv("GPASS_DIC"); - dict = dict ? dict : PREFIX "/share/gpass/eff.long"; + if (!dict && !(dict = getenv("GPASS_DIC"))) + dict = PREFIX "/share/gpass/eff.long"; for (int i = 0; i < npass; i++) gen(); }