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

doc/libgraph/sccmap.c

index 70ec5cdde6d6cd707ca19c5e78aa2972987e0406..f4ea22429ba98693f2d135f769328442b3e95528 100644 (file)
@@ -252,19 +252,13 @@ static void process(Agraph_t * G)
 
 }
 
-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, "gvpack: could not open file %s for %s\n",
-                               name, modestr);
+               fprintf(stderr, "gvpack: could not open file %s for writing\n", name);
                exit(1);
        }
        return (fp);
@@ -300,7 +294,7 @@ static void scanArgs(int argc, char **argv)
                        wantDegenerateComp = 1;
                        break;
                case 'o':
-                       outfp = openFile(optarg, "w");
+                       outfp = openFile(optarg);
                        break;
                case 'v':
                        Verbose = 1;