From 14a0baa719b200bdbc8a85fc2cdc1cd363408e2c Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 8 May 2022 17:14:13 -0700 Subject: [PATCH] graphml2gv: read XML input in chunks of 'BUFSIZ' MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The C standard library’s stdio exposes a value for the optimal chunk size for I/O. So use this instead of our arbitrarily chosen alternative. --- cmd/tools/graphml2gv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/tools/graphml2gv.c b/cmd/tools/graphml2gv.c index 94f8fb623..cd2128ec8 100644 --- a/cmd/tools/graphml2gv.c +++ b/cmd/tools/graphml2gv.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #ifdef HAVE_EXPAT #include @@ -25,7 +26,6 @@ #define XML_STATUS_ERROR 0 #endif -#define BUFSIZE 20000 #define SMALLBUF 1000 #define NAMEBUF 100 @@ -590,7 +590,7 @@ static void characterDataHandler(void *userData, const char *s, int length) static Agraph_t *graphml_to_gv(char* gname, FILE * graphmlFile, int* rv) { - char buf[BUFSIZE]; + char buf[BUFSIZ]; int done; userdata_t *udata = genUserdata(gname); XML_Parser parser = XML_ParserCreate(NULL); -- 2.40.0