]> granicus.if.org Git - graphviz/commitdiff
agsetfile: take a const char pointer instead of a mutable one
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 24 Jul 2021 17:54:22 +0000 (10:54 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 30 Jul 2021 03:34:15 +0000 (20:34 -0700)
This function does not modify the contents of the argument passed to it. Related
to #634.

lib/cgraph/cgraph.h
lib/cgraph/scan.l
lib/ingraphs/ingraphs.c

index 536bf42099e98d4326e7bcd6a3360eeca8a76d4a..1f7c1656d1ab1eeaf46b73cbb15d6e80a762118c 100644 (file)
@@ -256,7 +256,7 @@ CGRAPH_API Agraph_t *agread(void *chan, Agdisc_t * disc);
 CGRAPH_API Agraph_t *agmemread(const char *cp);
 CGRAPH_API Agraph_t *agmemconcat(Agraph_t *g, const char *cp);
 CGRAPH_API void agreadline(int);
-CGRAPH_API void agsetfile(char *);
+CGRAPH_API void agsetfile(const char *);
 CGRAPH_API Agraph_t *agconcat(Agraph_t * g, void *chan, Agdisc_t * disc);
 CGRAPH_API int agwrite(Agraph_t * g, void *chan);
 CGRAPH_API int agisdirected(Agraph_t * g);
index 938d07bb2a8b5dc3ef6d90548ebec9b442a9b8dc..3394a75ac78be627fe1965395a20b0f2fdb49999 100644 (file)
@@ -45,7 +45,7 @@ void agreadline(int n) { line_num = n; }
 
   /* (Re)set file:
    */
-void agsetfile(char* f) { InputFile = f; line_num = 1; }
+void agsetfile(const char* f) { InputFile = f; line_num = 1; }
 
 /* There is a hole here, because switching channels
  * requires pushing back whatever was previously read.
index e4d6602c4e97ca112c25e6b2946a29129bde8ec6..4d7ae562f55968b2de434b4637c9894d04a28159 100644 (file)
@@ -21,7 +21,7 @@ typedef struct {
     char *dummy;
 } Agraph_t;
 
-extern void agsetfile(char *);
+extern void agsetfile(const char *);
 
 #include <ingraphs/ingraphs.h>