]> granicus.if.org Git - graphviz/commitdiff
gvmap: [nfc] remove mode argument to openFile
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Jul 2021 02:07:00 +0000 (19:07 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Wed, 28 Jul 2021 02:53:30 +0000 (19:53 -0700)
This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gvmap.

cmd/gvmap/gvmap.c

index a8fdabd106de73333cb555f7f3693a0e1700fb16..e63ed33a7d81f8b2585dd1feb06853b8d56d6417 100644 (file)
@@ -128,19 +128,13 @@ static void usage(char* cmd, int eval)
     exit(eval);
 }
 
-static FILE *openFile(const char *name, const char *mode, const char* cmd)
+static FILE *openFile(const char *name, const char* cmd)
 {
     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);
@@ -246,7 +240,7 @@ init(int argc, char **argv, params_t* pm)
       pm->plotedges = true;
       break;
     case 'o':
-         pm->outfile = openFile(optarg, "w", pm->cmd);
+         pm->outfile = openFile(optarg, pm->cmd);
       break;
     case 'O':
       pm->color_optimize = false;