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

cmd/mingle/minglemain.c

index 051f82664742c6ceeab256830bdd03f5af95056e..27e5b07e888798f7076b443ca2a3feef7ba7320c 100644 (file)
@@ -47,19 +47,13 @@ typedef struct {
 static char *fname;
 static FILE *outfile;
 
-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);
@@ -167,7 +161,7 @@ static void init(int argc, char *argv[], opts_t* opts)
                                fprintf (stderr, "-k arg %s must be an integer >= 2 - ignored\n", optarg); 
                        break;
                case 'o':
-                       outfile = openFile(optarg, "w", cmd);
+                       outfile = openFile(optarg, cmd);
                        break;
                case 'p':
                        if ((sscanf(optarg,"%lf",&s) > 0))