From 26c89de6cdf0a5b7122a630a5df37fd67a4163e2 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 8 Nov 2013 23:28:16 -0800 Subject: Make usage() always exit(1) Avoid duplicating exit(1) calls after every single call to usage() Signed-off-by: Alan Coopersmith Reviewed-by: Gaetan Nadon --- mkfontscale.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'mkfontscale.c') diff --git a/mkfontscale.c b/mkfontscale.c index d73df8c..d27bb8d 100644 --- a/mkfontscale.c +++ b/mkfontscale.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include FT_FREETYPE_H @@ -113,7 +114,7 @@ static int reencodeLegacy; static char *encodingPrefix; static char *exclusionSuffix; -static void +static void _X_NORETURN _X_COLD usage(void) { fprintf(stderr, @@ -121,6 +122,7 @@ usage(void) " [ -a encoding ] [ -f fuzz ] [ -l ]\n" " [ -e directory ] [ -p prefix ] [ -n ] [ -r ] \n" " [-u] [-U] [-v] [ directory ]...\n"); + exit(1); } int @@ -167,25 +169,21 @@ main(int argc, char **argv) } else if (strcmp(argv[argn], "-x") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } exclusionSuffix = argv[argn + 1]; argn += 2; } else if(strcmp(argv[argn], "-a") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } makeList(&argv[argn + 1], 1, encodings, 0); argn += 2; } else if(strcmp(argv[argn], "-p") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } if(strlen(argv[argn + 1]) > NPREFIX - 1) { usage(); - exit(1); } free(encodingPrefix); encodingPrefix = dsprintf("%s", argv[argn + 1]); @@ -193,7 +191,6 @@ main(int argc, char **argv) } else if(strcmp(argv[argn], "-e") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } rc = readEncodings(encodingsToDo, argv[argn + 1]); if(rc < 0) @@ -223,14 +220,12 @@ main(int argc, char **argv) } else if(strcmp(argv[argn], "-o") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } outfilename = argv[argn + 1]; argn += 2; } else if(strcmp(argv[argn], "-f") == 0) { if(argn >= argc - 1) { usage(); - exit(1); } bigEncodingFuzz = atof(argv[argn + 1]) / 100.0; argn += 2; @@ -243,7 +238,6 @@ main(int argc, char **argv) exit(0); } else { usage(); - exit(1); } } -- cgit v1.2.3