From: Matthew Fernandez Date: Sat, 24 Jul 2021 17:54:22 +0000 (-0700) Subject: agsetfile: take a const char pointer instead of a mutable one X-Git-Tag: 2.49.0~36^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7854b33e11f20dbf9a5536af2295febb4033d26c;p=graphviz agsetfile: take a const char pointer instead of a mutable one This function does not modify the contents of the argument passed to it. Related to #634. --- diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h index 536bf4209..1f7c1656d 100644 --- a/lib/cgraph/cgraph.h +++ b/lib/cgraph/cgraph.h @@ -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); diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l index 938d07bb2..3394a75ac 100644 --- a/lib/cgraph/scan.l +++ b/lib/cgraph/scan.l @@ -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. diff --git a/lib/ingraphs/ingraphs.c b/lib/ingraphs/ingraphs.c index e4d6602c4..4d7ae562f 100644 --- a/lib/ingraphs/ingraphs.c +++ b/lib/ingraphs/ingraphs.c @@ -21,7 +21,7 @@ typedef struct { char *dummy; } Agraph_t; -extern void agsetfile(char *); +extern void agsetfile(const char *); #include