summaryrefslogtreecommitdiff
blob: ef213bccd8ab1adc0aa56b4ec2919ebd26c989b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f38cc8ff5..4f1a127a2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ## [Unreleased (4.0.1)]
 
+### Fixed
+
+- **Breaking**: The 4.0.0 change replacing the `Agiodisc_t` struct member
+  `putstr` by `printf` has been reverted
+
 ## [4.0.0] – 2022-05-29
 
 ### Changed
diff --git a/cmd/gvpr/gvprmain.c b/cmd/gvpr/gvprmain.c
index 188cfdf94..92872f8cd 100644
--- a/cmd/gvpr/gvprmain.c
+++ b/cmd/gvpr/gvprmain.c
@@ -47,14 +47,17 @@ static int iofread(void *chan, char *buf, int bufsize)
   return (int)fread(buf, 1, (size_t)bufsize, chan);
 }
 
+static int ioputstr(void *chan, const char *str)
+{
+  return fputs(str, chan);
+}
+
 static int ioflush(void *chan)
 {
   return fflush(chan);
 }
 
-typedef int (*printfn)(void *chan, const char *format, ...);
-
-static Agiodisc_t gprIoDisc = { iofread, (printfn)fprintf, ioflush };
+static Agiodisc_t gprIoDisc = { iofread, ioputstr, ioflush };
 
 static Agdisc_t gprDisc = { &AgMemDisc, &AgIdDisc, &gprIoDisc };
 
diff --git a/lib/cgraph/cgraph.3 b/lib/cgraph/cgraph.3
index ed7392c06..67e35c2e9 100644
--- a/lib/cgraph/cgraph.3
+++ b/lib/cgraph/cgraph.3
@@ -487,14 +487,14 @@ The I/O discipline provides an abstraction for the reading and writing of graphs
 .P0
 struct Agiodisc_s {
     int        (*fread)(void *chan, char *buf, int bufsize);
-    int        (*printf)(void *chan, const char *format, ...);
+    int        (*putstr)(void *chan, char *str);
     int        (*flush)(void *chan);    /* sync */
 } ;
 .P1
 Normally, the \fBFILE\fP structure and its related functions are used for I/O. At times, though,
 an application may need to use a totally different type of character source. The associated
 state or stream information is provided by the \fIchan\fP argument to \fBagread\fP or \fBagwrite\fP.
-The discipline function \fIfread\fP and \fIprintf\fP provide the corresponding functions for
+The discipline function \fIfread\fP and \fIputstr\fP provide the corresponding functions for
 read and writing.
 
 .SH "MEMORY DISCIPLINE"
diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h
index 7b005c442..cbec3bbe6 100644
--- a/lib/cgraph/cgraph.h
+++ b/lib/cgraph/cgraph.h
@@ -169,7 +169,7 @@ struct Agiddisc_s {		/* object ID allocator */
 
 struct Agiodisc_s {
     int (*afread) (void *chan, char *buf, int bufsize);
-    int (*printf)(void *chan, const char *format, ...);
+    int (*putstr) (void *chan, const char *str);
     int (*flush) (void *chan);	/* sync */
     /* error messages? */
 };
diff --git a/lib/cgraph/io.c b/lib/cgraph/io.c
index d8b136804..66c605ae6 100644
--- a/lib/cgraph/io.c
+++ b/lib/cgraph/io.c
@@ -24,15 +24,17 @@ static int iofread(void *chan, char *buf, int bufsize)
 }
 
 /* default IO methods */
+static int ioputstr(void *chan, const char *str)
+{
+    return fputs(str, chan);
+}
 
 static int ioflush(void *chan)
 {
     return fflush(chan);
 }
 
-typedef int (*printfn)(void *chan, const char *format, ...);
-
-Agiodisc_t AgIoDisc = { iofread, (printfn)fprintf, ioflush };
+Agiodisc_t AgIoDisc = { iofread, ioputstr, ioflush };
 
 typedef struct {
     const char *data;
@@ -78,7 +80,7 @@ static Agraph_t *agmemread0(Agraph_t *arg_g, const char *cp)
     rdr_t rdr;
     Agdisc_t disc;
 
-    memIoDisc.printf = AgIoDisc.printf;
+    memIoDisc.putstr = AgIoDisc.putstr;
     memIoDisc.flush = AgIoDisc.flush;
     rdr.data = cp;
     rdr.len = strlen(cp);
diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c
index e14f7d835..9e72d2c5c 100644
--- a/lib/cgraph/write.c
+++ b/lib/cgraph/write.c
@@ -26,7 +26,7 @@ typedef void iochan_t;
 
 static int ioput(Agraph_t * g, iochan_t * ofile, char *str)
 {
-    return AGDISC(g, io)->printf(ofile, "%s", str);
+    return AGDISC(g, io)->putstr(ofile, str);
 
 }
 
diff --git a/lib/gvpr/compile.c b/lib/gvpr/compile.c
index a7fe27bf5..3704f51d9 100644
--- a/lib/gvpr/compile.c
+++ b/lib/gvpr/compile.c
@@ -66,14 +66,17 @@ static int iofread(void *chan, char *buf, int bufsize)
     return (int)read(sffileno(chan), buf, bufsize);
 }
 
+static int ioputstr(void *chan, const char *str)
+{
+    return sfputr(chan, str, -1);
+}
+
 static int ioflush(void *chan)
 {
     return sfsync(chan);
 }
 
-typedef int (*printfn)(void *chan, const char *format, ...);
-
-static Agiodisc_t gprIoDisc = { iofread, (printfn)sfprintf, ioflush };
+static Agiodisc_t gprIoDisc = { iofread, ioputstr, ioflush };
 
 #ifdef GVDLL
 static Agdisc_t gprDisc = { 0, 0, &gprIoDisc };
diff --git a/plugin/core/gvrender_core_dot.c b/plugin/core/gvrender_core_dot.c
index c45563460..63eb5e535 100644
--- a/plugin/core/gvrender_core_dot.c
+++ b/plugin/core/gvrender_core_dot.c
@@ -511,7 +511,7 @@ static void xdot_end_graph(graph_t* g)
     textflags[EMIT_GLABEL] = 0;
 }
 
-typedef int (*printfn)(void *chan, const char *format, ...);
+typedef int (*putstrfn) (void *chan, const char *str);
 typedef int (*flushfn) (void *chan);
 static void dot_end_graph(GVJ_t *job)
 {
@@ -521,7 +521,7 @@ static void dot_end_graph(GVJ_t *job)
 
     if (io.afread == NULL) {
 	io.afread = AgIoDisc.afread;
-	io.printf = (printfn)gvprintf;
+	io.putstr = (putstrfn)gvputs;
 	io.flush = (flushfn)gvflush;
     }
 
diff --git a/plugin/core/gvrender_core_json.c b/plugin/core/gvrender_core_json.c
index bab5d64af..88715a93a 100644
--- a/plugin/core/gvrender_core_json.c
+++ b/plugin/core/gvrender_core_json.c
@@ -693,7 +693,7 @@ static void write_graph(Agraph_t * g, GVJ_t * job, int top, state_t* sp)
 	gvputs(job, "}");
 }
 
-typedef int (*printfn)(void *chan, const char *format, ...);
+typedef int (*putstrfn) (void *chan, const char *str);
 typedef int (*flushfn) (void *chan);
 
 static void json_end_graph(GVJ_t *job)
@@ -704,7 +704,7 @@ static void json_end_graph(GVJ_t *job)
 
     if (io.afread == NULL) {
 	io.afread = AgIoDisc.afread;
-	io.printf = (printfn)gvprintf;
+	io.putstr = (putstrfn)gvputs;
 	io.flush = (flushfn)gvflush;
     }
 
diff --git a/tclpkg/tcldot/tcldot.c b/tclpkg/tcldot/tcldot.c
index 335d8e469..b747124cf 100644
--- a/tclpkg/tcldot/tcldot.c
+++ b/tclpkg/tcldot/tcldot.c
@@ -163,7 +163,7 @@ int Tcldot_Init(Tcl_Interp * interp)
     /* build disciplines dynamically so we can selectively replace functions */
 
     ictx->myioDisc.afread = NULL;            /* set in dotread() or dotstring() according to need */
-    ictx->myioDisc.printf = AgIoDisc.printf; /* no change */
+    ictx->myioDisc.putstr = AgIoDisc.putstr; /* no change */
     ictx->myioDisc.flush = AgIoDisc.flush;   /* no change */
 
     ictx->mydisc.mem = &AgMemDisc;           /* no change */
diff --git a/lib/common/output.c b/lib/common/output.c
index c91dfe41e..648409c5a 100644
--- a/lib/common/output.c
+++ b/lib/common/output.c
@@ -80,11 +80,11 @@ void write_plain(GVJ_t *job, graph_t *g,
     bezier bz;
     pointf pt;
     char *lbl;
     char* fillcolor;
 
-    print = g->clos->disc.io->printf;
+    print = g->clos->disc.io->putstr;
 //    setup_graph(job, g);
     setYInvert(g);
     pt = GD_bb(g).UR;
     print(f, "graph %.5g %.5g %.5g\n", job->zoom, PS2INCH(pt.x), PS2INCH(pt.y));
     for (n = agfstnode(g); n; n = agnxtnode(g, n)) {