From 7854b33e11f20dbf9a5536af2295febb4033d26c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sat, 24 Jul 2021 10:54:22 -0700 Subject: [PATCH] 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. --- lib/cgraph/cgraph.h | 2 +- lib/cgraph/scan.l | 2 +- lib/ingraphs/ingraphs.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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 -- 2.40.0