From: Matthew Fernandez Date: Thu, 22 Jul 2021 02:22:11 +0000 (-0700) Subject: unflatten: [nfc] remove mode argument to openFile X-Git-Tag: 2.49.0~41^2~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee6e680ec532591ff8fe37d5fe7d082179f164d4;p=graphviz unflatten: [nfc] remove mode argument to openFile This function is only ever called with mode "w". This is the equivalent of 21a6f2e2f7e8a377977c7bdad1356591a25d516f for unflatten. --- diff --git a/cmd/tools/unflatten.c b/cmd/tools/unflatten.c index 078d2b4d9..e3e9be61f 100644 --- a/cmd/tools/unflatten.c +++ b/cmd/tools/unflatten.c @@ -145,19 +145,13 @@ static void usage(int v) exit(v); } -static FILE *openFile(const char *name, const char *mode) +static FILE *openFile(const char *name) { FILE *fp; - char *modestr; - fp = fopen(name, mode); + fp = fopen(name, "w"); if (!fp) { - if (*mode == 'r') - modestr = "reading"; - else - modestr = "writing"; - fprintf(stderr, "%s: could not open file %s for %s\n", - cmd, name, modestr); + fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name); exit(-1); } return fp; @@ -187,7 +181,7 @@ static char **scanargs(int argc, char **argv) case 'o': if (outFile != NULL) fclose(outFile); - outFile = openFile(optarg, "w"); + outFile = openFile(optarg); break; case '?': if (optopt == '?')