From: Matthew Fernandez Date: Thu, 22 Jul 2021 02:16:30 +0000 (-0700) Subject: graphml2gv: [nfc] remove mode argument to openFile X-Git-Tag: 2.49.0~41^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c4e1605e5ec43cf864fb1f9bb5e361efe138e9d0;p=graphviz graphml2gv: [nfc] remove mode argument to openFile This function is only ever called with mode "w". This is the equivalent of 21a6f2e2f7e8a377977c7bdad1356591a25d516f for graphml2gv. --- diff --git a/cmd/tools/graphml2gv.c b/cmd/tools/graphml2gv.c index ceda49686..a3306f1e5 100644 --- a/cmd/tools/graphml2gv.c +++ b/cmd/tools/graphml2gv.c @@ -661,19 +661,13 @@ static FILE *getFile(void) return rv; } -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", - CmdName, name, modestr); + fprintf(stderr, "%s: could not open file %s for writing\n", CmdName, name); perror(name); exit(1); } @@ -721,7 +715,7 @@ static void initargs(int argc, char **argv) case 'o': if (outFile != NULL) fclose(outFile); - outFile = openFile(optarg, "w"); + outFile = openFile(optarg); break; case ':': fprintf(stderr, "%s: option -%c missing argument\n", CmdName, optopt);