]> granicus.if.org Git - graphviz/commitdiff
cluster: [nfc] remove mode argument to openFile
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 22 Jul 2021 02:05:12 +0000 (19:05 -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 cluster.

cmd/gvmap/cluster.c

index 26f6e3c7688f5c99bf036f67b3e67b8caa07cfab..dd1f519f99f38eec254c38ef3aec5da91fb64b1e 100644 (file)
@@ -64,19 +64,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;
@@ -107,7 +101,7 @@ static void init(int argc, char *argv[], opts_t* opts) {
       else opts->maxcluster = v;
       break;
     case 'o':
-      opts->outfp = openFile(optarg, "w", cmd);
+      opts->outfp = openFile(optarg, cmd);
       break;
     case 'v':
       Verbose = 1;