]> granicus.if.org Git - graphviz/log
graphviz
3 years agoeval: avoid sfprintf in integer-to-string dynamic
Matthew Fernandez [Sat, 24 Jul 2021 02:26:37 +0000 (19:26 -0700)]
eval: avoid sfprintf in integer-to-string dynamic

Instead of constructing a string in the `tmp` buffer and then eventually
allocating vmalloc space to copy this into, we can simply compute the number of
bytes in advance, allocate vmalloc space, and then directly emit the output into
the vmalloc buffer. Related to #1873, #1998.

3 years agoeval: avoid sfprintf in integer-to-string static
Matthew Fernandez [Sat, 24 Jul 2021 02:24:48 +0000 (19:24 -0700)]
eval: avoid sfprintf in integer-to-string static

Instead of constructing a string in the `tmp` buffer and then eventually
allocating vmalloc space to copy this into, we can simply compute the number of
bytes in advance, allocate vmalloc space, and then directly emit the output into
the vmalloc buffer. Related to #1873, #1998.

3 years agoeval: avoid sfprintf in float-to-string dynamic
Matthew Fernandez [Sat, 24 Jul 2021 02:13:45 +0000 (19:13 -0700)]
eval: avoid sfprintf in float-to-string dynamic

Instead of constructing a string in the `tmp` buffer and then eventually
allocating vmalloc space to copy this into, we can simply compute the number of
bytes in advance, allocate vmalloc space, and then directly emit the output into
the vmalloc buffer. Related to #1873, #1998.

3 years agoeval: avoid sfprintf in float-to-string static
Matthew Fernandez [Sat, 24 Jul 2021 02:10:40 +0000 (19:10 -0700)]
eval: avoid sfprintf in float-to-string static

Instead of constructing a string in the `tmp` buffer and then eventually
allocating vmalloc space to copy this into, we can simply compute the number of
bytes in advance, allocate vmalloc space, and then directly emit the output into
the vmalloc buffer. Related to #1873, #1998.

3 years agoMerge branch 'fix-include-warning' into 'main'
Matthew Fernandez [Tue, 3 Aug 2021 03:42:08 +0000 (03:42 +0000)]
Merge branch 'fix-include-warning' into 'main'

plugin/gdiplus: Fix warning with header file name

See merge request graphviz/graphviz!2079

3 years agoplugin/gdiplus: Fix warning with header file name
Biswapriyo Nath [Wed, 28 Jul 2021 16:00:47 +0000 (21:30 +0530)]
plugin/gdiplus: Fix warning with header file name

This fixes the following warning with clang in mingw
warning: non-portable path to file '<gdiplus.h>'; specified path differs in case from file name on disk [-Wnonportable-include-path]

3 years agoMerge branch 'smattr/B40D0BFD-1F7E-4DF2-8043-2612346DBEE9' into 'main'
Matthew Fernandez [Mon, 2 Aug 2021 03:08:52 +0000 (03:08 +0000)]
Merge branch 'smattr/B40D0BFD-1F7E-4DF2-8043-2612346DBEE9' into 'main'

gcalloc: fix: do not abort on calloc(0, 0) returning NULL

See merge request graphviz/graphviz!2078

3 years agogcalloc: fix: do not abort on calloc(0, x) or calloc(x, 0) returning NULL
Matthew Fernandez [Mon, 26 Jul 2021 04:52:08 +0000 (21:52 -0700)]
gcalloc: fix: do not abort on calloc(0, x) or calloc(x, 0) returning NULL

Commit 43a37bedd934bde50a6441766b85dfc9648abda9 added a `calloc` wrapper but
mistakenly did not account for it being valid for `calloc` to return `NULL` when
the input arguments are 0. This is unlikely to have caused a problem with Glibc
whose allocator typically returns non-null pointers even for 0 allocations.
However assuming a 0 allocation may return a null pointer is more portable.

3 years agoMerge branch 'smattr/D1A6A66B-15B4-449F-BB71-088F95E12676' into 'main'
Matthew Fernandez [Mon, 2 Aug 2021 01:26:53 +0000 (01:26 +0000)]
Merge branch 'smattr/D1A6A66B-15B4-449F-BB71-088F95E12676' into 'main'

fix an #if _WIN32

See merge request graphviz/graphviz!2073

3 years agofix an #if _WIN32
Matthew Fernandez [Sat, 24 Jul 2021 22:31:39 +0000 (15:31 -0700)]
fix an #if _WIN32

This worked out correctly, as _WIN32 is defined to 1 on Windows and is undefined
elsewhere. But it triggered -Wundef compiler warnings on non-Windows platforms.

3 years agoMerge branch 'smattr/2D62A146-06BC-4160-B15F-B8F495E8589C' into 'main'
Matthew Fernandez [Fri, 30 Jul 2021 05:23:18 +0000 (05:23 +0000)]
Merge branch 'smattr/2D62A146-06BC-4160-B15F-B8F495E8589C' into 'main'

squash some Pylint warnings

See merge request graphviz/graphviz!2080

3 years agodisable a wrong-import-position Pylint warning around run_c
Matthew Fernandez [Thu, 29 Jul 2021 00:22:38 +0000 (17:22 -0700)]
disable a wrong-import-position Pylint warning around run_c

This import has to come out of order because it only works due to prior sys.path
tweaks.

3 years agodisable Pylint’s too-many-lines warning
Matthew Fernandez [Thu, 29 Jul 2021 00:21:28 +0000 (17:21 -0700)]
disable Pylint’s too-many-lines warning

By the nature of how Graphviz makes use of Python, some test sources are long
files of independent functions. It does not make sense to split these up and
having long files is not an impediment to maintaining these test cases.

3 years agoaddress some missing docstring Pylint warnings
Matthew Fernandez [Thu, 29 Jul 2021 00:21:10 +0000 (17:21 -0700)]
address some missing docstring Pylint warnings

3 years agoMerge branch 'smattr/90bb42c1-3025-449a-8300-7ec7776f7c33' into 'main'
Matthew Fernandez [Fri, 30 Jul 2021 04:23:10 +0000 (04:23 +0000)]
Merge branch 'smattr/90bb42c1-3025-449a-8300-7ec7776f7c33' into 'main'

make agsetfile argument a const char*

See merge request graphviz/graphviz!2072

3 years agoCFrmSettings::createLayout: remove now-unnecessary cast of a agsetfile parameter
Matthew Fernandez [Sat, 24 Jul 2021 17:59:47 +0000 (10:59 -0700)]
CFrmSettings::createLayout: remove now-unnecessary cast of a agsetfile parameter

Related to #634.

3 years agoagsetfile: take a const char pointer instead of a mutable one
Matthew Fernandez [Sat, 24 Jul 2021 17:54:22 +0000 (10:54 -0700)]
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.

3 years agocgraph: use a const char pointer for storing input filename
Matthew Fernandez [Sat, 24 Jul 2021 17:52:40 +0000 (10:52 -0700)]
cgraph: use a const char pointer for storing input filename

Related to #634.

3 years agochkNum: use a const char pointer for storing input file name
Matthew Fernandez [Sat, 24 Jul 2021 17:49:15 +0000 (10:49 -0700)]
chkNum: use a const char pointer for storing input file name

Related to #634.

3 years agoMerge branch 'smattr/51C10EB6-96A3-4442-9E10-9CE23E07AD2F' into 'main'
Matthew Fernandez [Fri, 30 Jul 2021 03:33:09 +0000 (03:33 +0000)]
Merge branch 'smattr/51C10EB6-96A3-4442-9E10-9CE23E07AD2F' into 'main'

minor no-op clean up

See merge request graphviz/graphviz!2076

3 years agoremove conditional inlining of mydist
Matthew Fernandez [Sun, 25 Jul 2021 20:28:10 +0000 (13:28 -0700)]
remove conditional inlining of mydist

Modern compilers mostly ignore `inline` and make their own decisions about
whether to inline a function or not.

3 years agoremove unused Windows gettxt redirect
Matthew Fernandez [Sun, 25 Jul 2021 20:26:06 +0000 (13:26 -0700)]
remove unused Windows gettxt redirect

3 years agoMerge branch 'smattr/2A41855C-DA22-4790-B27C-C1FF9B6108BC' into 'main'
Matthew Fernandez [Fri, 30 Jul 2021 00:52:57 +0000 (00:52 +0000)]
Merge branch 'smattr/2A41855C-DA22-4790-B27C-C1FF9B6108BC' into 'main'

install Python3 to a known path in Windows CI

Closes #2085

See merge request graphviz/graphviz!2067

3 years agoinstall Python3 to a known path in Windows CI
Matthew Fernandez [Fri, 23 Jul 2021 01:35:09 +0000 (18:35 -0700)]
install Python3 to a known path in Windows CI

This avoids a latent problem wherein Python is installed to a directory
containing its version number and the follow on `Path` manipulation was hard
coded to Python 3.9. This would have broken as soon as Python 3.10 became
available through Chocolatey. Closes #2085. Note, I still do not understand why
the documented technique Chocolatey recommends of `refreshenv` does not work.

3 years agoMerge branch 'smattr/b672cf7c-7615-4629-b14d-4760b3a76c03' into 'main'
Matthew Fernandez [Thu, 29 Jul 2021 19:59:19 +0000 (19:59 +0000)]
Merge branch 'smattr/b672cf7c-7615-4629-b14d-4760b3a76c03' into 'main'

remove vmresize

See merge request graphviz/graphviz!2060

3 years agoremove return type from assignable
Matthew Fernandez [Mon, 19 Jul 2021 00:48:16 +0000 (17:48 -0700)]
remove return type from assignable

This function only ever returns 1 and no calls check its return value.

3 years agoremove unnecessary casts of disc->user
Matthew Fernandez [Mon, 19 Jul 2021 00:44:52 +0000 (17:44 -0700)]
remove unnecessary casts of disc->user

This pointer implicitly coerces.

3 years agoreflow some text in lib/gvpr
Matthew Fernandez [Mon, 19 Jul 2021 00:44:32 +0000 (17:44 -0700)]
reflow some text in lib/gvpr

3 years agoxyOf: use size_t for string length
Matthew Fernandez [Mon, 19 Jul 2021 00:43:50 +0000 (17:43 -0700)]
xyOf: use size_t for string length

Squashes a -Wsign-conversion warning.

3 years agobbOf: use size_t for string length
Matthew Fernandez [Mon, 19 Jul 2021 00:43:23 +0000 (17:43 -0700)]
bbOf: use size_t for string length

Squashes a -Wsign-conversion warning.

3 years agoxyOf: use a C99 bool argument to more strongly indicate a type
Matthew Fernandez [Mon, 19 Jul 2021 00:42:52 +0000 (17:42 -0700)]
xyOf: use a C99 bool argument to more strongly indicate a type

3 years agobbOf: use a C99 bool argument to more strongly indicate a type
Matthew Fernandez [Mon, 19 Jul 2021 00:42:24 +0000 (17:42 -0700)]
bbOf: use a C99 bool argument to more strongly indicate a type

3 years agoremove some unnecessary forward declarations
Matthew Fernandez [Mon, 19 Jul 2021 00:30:37 +0000 (17:30 -0700)]
remove some unnecessary forward declarations

3 years agoremove now-unused vmresize
Matthew Fernandez [Mon, 19 Jul 2021 00:22:30 +0000 (17:22 -0700)]
remove now-unused vmresize

3 years agoremove now-unused vmnewof
Matthew Fernandez [Mon, 19 Jul 2021 00:12:48 +0000 (17:12 -0700)]
remove now-unused vmnewof

3 years agoscformat: use vmalloc instead of vmresize when processing '['
Matthew Fernandez [Mon, 19 Jul 2021 00:09:59 +0000 (17:09 -0700)]
scformat: use vmalloc instead of vmresize when processing '['

Though it is hard to see, the previous code bottomed out in a call to vmresize.
After allocating, it zeroes the allocated region. So vmresize (itself calling
realloc) signals an unnecessary constraint to the allocator that previous data
in this memory must be preserved.

To simplify this, this change converts the sequence to a vmfree of the prior
memory and then a new vmalloc, more clearly divorcing the new buffer from the
old one.

3 years agosimplify exalloc
Matthew Fernandez [Sun, 18 Jul 2021 23:53:30 +0000 (16:53 -0700)]
simplify exalloc

This macro eventually bottoms out on a call to vmresize with NULL. We can
simplify this to directly calling vmalloc instead.

3 years agoexstralloc: call vmalloc instead of vmresize
Matthew Fernandez [Sun, 18 Jul 2021 23:42:41 +0000 (16:42 -0700)]
exstralloc: call vmalloc instead of vmresize

When passing an input pointer of NULL, vmresize is equivalent to vmalloc. So we
can shortcut the whole thing by just calling vmalloc directly.

3 years agoremove p argument to exstralloc
Matthew Fernandez [Sun, 18 Jul 2021 23:39:30 +0000 (16:39 -0700)]
remove p argument to exstralloc

This function is only ever called with NULL for this argument.

3 years agoMerge branch 'smattr/3f6d98e5-32f1-4219-aaf4-6e595331f922' into 'main'
Matthew Fernandez [Wed, 28 Jul 2021 04:43:56 +0000 (04:43 +0000)]
Merge branch 'smattr/3f6d98e5-32f1-4219-aaf4-6e595331f922' into 'main'

remove sfsprintf

See merge request graphviz/graphviz!2066

3 years agoremove now-unused sfio functionality for printing to strings
Matthew Fernandez [Thu, 22 Jul 2021 03:28:21 +0000 (20:28 -0700)]
remove now-unused sfio functionality for printing to strings

Related to #1998.

3 years agotrace: replace sfsprintf calls with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:21:33 +0000 (20:21 -0700)]
trace: replace sfsprintf calls with snprintf

Related to #1998.

3 years agogetdyn: replace sfsprintf call with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:15:35 +0000 (20:15 -0700)]
getdyn: replace sfsprintf call with snprintf

Related to #1998.

3 years agoevaldyn: replace sfsprintf call with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:14:43 +0000 (20:14 -0700)]
evaldyn: replace sfsprintf call with snprintf

Related to #1998.

3 years agolexname: replace sfsprintf calls with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:11:57 +0000 (20:11 -0700)]
lexname: replace sfsprintf calls with snprintf

Related to #1998.

3 years agolexname: fix latent buffer overflow
Matthew Fernandez [Sat, 24 Jul 2021 22:37:34 +0000 (15:37 -0700)]
lexname: fix latent buffer overflow

Buffers of length MAXNAME are printed into, including in a case where the
printed string is "(EXTERNAL:%d)". This needs a maximum of 23 bytes, not 16
bytes as was previously used. This overflow looks impossible to actually trigger
because I believe this code path is only used in the case of a bug in the lexer
itself. Hence no changelog entry for this.

This issue was exposed when moving sfsprintf calls to snsprintf, as the compiler
understands the semantics of the latter and knows how to warn about detectable
overflows. Related to #1998.

3 years agoexccopen: replace sfsprintf call with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:07:36 +0000 (20:07 -0700)]
exccopen: replace sfsprintf call with snprintf

Related to #1998.

3 years agoexopname: replace sfsprintf call with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 03:06:45 +0000 (20:06 -0700)]
exopname: replace sfsprintf call with snprintf

Related to #1998.

3 years agopathfind: replace sfsprintf calls with snprintf
Matthew Fernandez [Thu, 22 Jul 2021 02:59:25 +0000 (19:59 -0700)]
pathfind: replace sfsprintf calls with snprintf

Related to #1998.

3 years agoMerge branch 'smattr/fbbdaf80-7180-4b89-8e4d-2f12839b234f' into 'main'
Matthew Fernandez [Wed, 28 Jul 2021 03:43:07 +0000 (03:43 +0000)]
Merge branch 'smattr/fbbdaf80-7180-4b89-8e4d-2f12839b234f' into 'main'

[nfc] remove mode argument to openFile

See merge request graphviz/graphviz!2065

3 years agospine: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:33:18 +0000 (19:33 -0700)]
spine: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for spine.

3 years agodoc/libgraph/Makefile: remove unused TEXS variable
Matthew Fernandez [Thu, 22 Jul 2021 02:29:20 +0000 (19:29 -0700)]
doc/libgraph/Makefile: remove unused TEXS variable

It is not clear to me what the purpose of this variable is/was. This Makefile
was added in adf9f9ad70662c0ca291feea1eb51df113c7d281. Even in that revision,
the variable was unused and refers to the non-existent file graph.tex.

3 years agodoc sccmap: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:26:19 +0000 (19:26 -0700)]
doc sccmap: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for the copy of sccmap in doc/.

3 years agounflatten: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:22:11 +0000 (19:22 -0700)]
unflatten: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for unflatten.

3 years agosccmap: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:20:52 +0000 (19:20 -0700)]
sccmap: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for sccmap.

3 years agogvpack: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:19:53 +0000 (19:19 -0700)]
gvpack: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gvpack.

3 years agogvgen: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:18:49 +0000 (19:18 -0700)]
gvgen: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gvgen.

3 years agogv2gml: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:17:48 +0000 (19:17 -0700)]
gv2gml: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gv2gml.

3 years agographml2gv: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:16:30 +0000 (19:16 -0700)]
graphml2gv: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for graphml2gv.

3 years agogml2gv: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:14:51 +0000 (19:14 -0700)]
gml2gv: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gml2gv.

3 years agocvtgxl: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:10:36 +0000 (19:10 -0700)]
cvtgxl: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for cvtgxl.

3 years agomingle: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:08:49 +0000 (19:08 -0700)]
mingle: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for mingle.

3 years agogvmap: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:07:00 +0000 (19:07 -0700)]
gvmap: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for gvmap.

3 years agocluster: [nfc] remove mode argument to openFile
Matthew Fernandez [Thu, 22 Jul 2021 02:05:12 +0000 (19:05 -0700)]
cluster: [nfc] remove mode argument to openFile

This function is only ever called with mode "w". This is the equivalent of
21a6f2e2f7e8a377977c7bdad1356591a25d516f for cluster.

3 years agoMerge branch 'smattr/73792e61-f73a-4119-9604-12749cd2bf7e' into 'main'
Matthew Fernandez [Wed, 28 Jul 2021 01:06:31 +0000 (01:06 +0000)]
Merge branch 'smattr/73792e61-f73a-4119-9604-12749cd2bf7e' into 'main'

more warning squashing, around strlen usage

See merge request graphviz/graphviz!2074

3 years agouse size_t when handling the length of some directory lists
Matthew Fernandez [Sat, 24 Jul 2021 23:54:02 +0000 (16:54 -0700)]
use size_t when handling the length of some directory lists

Squashes five -Wsign-compare/-Wconversion warnings.

3 years agofindPath: remove some unnecessary brackets
Matthew Fernandez [Sat, 24 Jul 2021 23:49:56 +0000 (16:49 -0700)]
findPath: remove some unnecessary brackets

3 years agoFgets: use size_t instead of int for buffer length
Matthew Fernandez [Sat, 24 Jul 2021 23:41:11 +0000 (16:41 -0700)]
Fgets: use size_t instead of int for buffer length

Squashes three -Wconversion warnings.

3 years agouse size_t when dealing with string lengths of XML tokens
Matthew Fernandez [Sat, 24 Jul 2021 23:31:27 +0000 (16:31 -0700)]
use size_t when dealing with string lengths of XML tokens

Squashes a number of -Wconversion warnings.

3 years agoexsubstr: remove some unnecessary bracketing
Matthew Fernandez [Sat, 24 Jul 2021 23:16:29 +0000 (16:16 -0700)]
exsubstr: remove some unnecessary bracketing

3 years agoprformat: use a size_t when dealing with string lengths
Matthew Fernandez [Sat, 24 Jul 2021 23:12:09 +0000 (16:12 -0700)]
prformat: use a size_t when dealing with string lengths

Squashes three -Wconversion warnings.

3 years agostrip_dir: replace ad hoc boolean with C99 bool
Matthew Fernandez [Sat, 24 Jul 2021 23:10:20 +0000 (16:10 -0700)]
strip_dir: replace ad hoc boolean with C99 bool

3 years agostrip_dir: rewite character loop using a size_t
Matthew Fernandez [Sat, 24 Jul 2021 23:06:50 +0000 (16:06 -0700)]
strip_dir: rewite character loop using a size_t

Squashes a -Wconversion warning.

3 years agostrip_dir: remove an unnecessary cast
Matthew Fernandez [Sat, 24 Jul 2021 23:04:07 +0000 (16:04 -0700)]
strip_dir: remove an unnecessary cast

&s[i+1] is already a char*.

3 years agotrack rdr_t offset and extent as size_t instead of int
Matthew Fernandez [Sat, 24 Jul 2021 23:00:19 +0000 (16:00 -0700)]
track rdr_t offset and extent as size_t instead of int

Provides more flexibility for larger data and better interoperates with strlen,
squashing a -Wconversion warning.

3 years agoMerge branch 'smattr/0E77B8A2-8B78-48BB-9CFC-4D40C6A734B0' into 'main'
Matthew Fernandez [Tue, 27 Jul 2021 16:07:25 +0000 (16:07 +0000)]
Merge branch 'smattr/0E77B8A2-8B78-48BB-9CFC-4D40C6A734B0' into 'main'

ccomps: some clean up

See merge request graphviz/graphviz!2075

3 years agoccomps: use size_t when dealing with buffer sizes in chkGraphName
Matthew Fernandez [Sun, 25 Jul 2021 17:42:28 +0000 (10:42 -0700)]
ccomps: use size_t when dealing with buffer sizes in chkGraphName

Squashes a -Wconversion and a -Wsign-conversion warning.

3 years agoccomps: use a size_t when dealing with buffer sizes in getBuf
Matthew Fernandez [Sun, 25 Jul 2021 17:37:41 +0000 (10:37 -0700)]
ccomps: use a size_t when dealing with buffer sizes in getBuf

Squashes a -Wsign-conversion and four -Wconversion warnings.

3 years agoccomps: mark getopt switch as exhaustive
Matthew Fernandez [Sun, 25 Jul 2021 17:35:37 +0000 (10:35 -0700)]
ccomps: mark getopt switch as exhaustive

Squashes a -Wswitch-default warning.

3 years agoccomps: use a size_t when dealing with character offsets in split
Matthew Fernandez [Sun, 25 Jul 2021 17:34:10 +0000 (10:34 -0700)]
ccomps: use a size_t when dealing with character offsets in split

Squashes a -Wconversion and a -Wsign-conversion warning.

3 years agoccomps: abort on all allocation failures
Matthew Fernandez [Sun, 25 Jul 2021 00:36:44 +0000 (17:36 -0700)]
ccomps: abort on all allocation failures

None of the allocations in ccomps could tolerate failure. So this change makes
them all call wrappers that cleanly abort in the event of out-of-memory. Note
that this also fixes an issue where ccomps incorrectly identified itself as `gc`
in one of the previous failure messages.

3 years agoccomps: remove an unnecessary code path in getBuf
Matthew Fernandez [Sun, 25 Jul 2021 00:26:21 +0000 (17:26 -0700)]
ccomps: remove an unnecessary code path in getBuf

When len is 0, buf is NULL and thus calling realloc is equivalent to calling
malloc.

3 years agoMerge branch 'smattr/728D79B1-E42D-4105-811D-08FA2A361B6F' into 'main'
Matthew Fernandez [Tue, 27 Jul 2021 05:06:12 +0000 (05:06 +0000)]
Merge branch 'smattr/728D79B1-E42D-4105-811D-08FA2A361B6F' into 'main'

remove Windows overrides of `inline`

See merge request graphviz/graphviz!2063

3 years agoremove Windows overrides of `inline`
Matthew Fernandez [Wed, 21 Jul 2021 03:58:59 +0000 (20:58 -0700)]
remove Windows overrides of `inline`

The `undef` part of this macro juggling was typoed as `WIN32_STATIC` in commit
b26b5fc076c1b5d9919ce79c807f5b3921149597, so it never properly undid the
preceding `inline` redirection. However, this redirection is unnecessary anyway.
Contrary to the Microsoft docs,¹ the `inline` keyword seems understood in *both*
C and C++.

¹ https://docs.microsoft.com/en-us/cpp/cpp/inline-functions-cpp?view=msvc-160

3 years agoMerge branch 'smattr/007BBBEC-441C-49AA-9E7F-31A25ACE5257' into 'main'
Matthew Fernandez [Tue, 27 Jul 2021 00:58:04 +0000 (00:58 +0000)]
Merge branch 'smattr/007BBBEC-441C-49AA-9E7F-31A25ACE5257' into 'main'

replace mkdefs-generated gdefs.h with X macros

Closes #2101

See merge request graphviz/graphviz!2062

3 years agoreplace mkdefs-generated gdefs.h with X macros
Matthew Fernandez [Tue, 20 Jul 2021 03:25:16 +0000 (20:25 -0700)]
replace mkdefs-generated gdefs.h with X macros

Prior to this commit, the gdefs.h header was generated by a C program, mkdefs.c.
There were a number of issues with this approach:

  1. The CMake build system was assuming the compiler to build mkdefs.c and the
     compiler to build Graphviz itself were the same. This is not necessarily
     true when cross-compiling.

  2. Generation under MSBuild seems to have been impractical, so the generated
     header was checked in to the repository under windows/include/gvpr/gdefs.h,
     somewhat defeating the purpose of making it generated.

  3. The CMake build system seems to not have been setup to correctly compile
     mkdefs.c under all circumstances (see #2101).

This change removes any reliance on a host C compiler and instead uses a series
of X macros¹ to achieve the same effect. The values of all generated constants
and the content of generated structures is intended to be unchanged, though some
#defines have been altered to enums. In these cases, there was no advantage to
using a macro and multiple advantages to not using a macro.

This change is affecting a shipped header (gdefs.h) and also removes it from the
list of shipped headers. Installing it appears to have been a mistake as there
is no easy way for end users to use it. The header, fully expanded, still relies
on further expansion of macros that are only defined in expr.h, a header that is
not shipped.

Closes #2101.

¹ https://en.wikipedia.org/wiki/X_Macro

3 years agoMerge branch 'smattr/F218DB16-9060-4D1D-88E2-DDDBF8A5034D' into 'main'
Matthew Fernandez [Sat, 24 Jul 2021 18:22:56 +0000 (18:22 +0000)]
Merge branch 'smattr/F218DB16-9060-4D1D-88E2-DDDBF8A5034D' into 'main'

add Fedora 34 testing to CI

Closes #2059

See merge request graphviz/graphviz!2070

3 years agoadd Fedora 34 testing to CI
Matthew Fernandez [Sat, 24 Jul 2021 00:28:55 +0000 (17:28 -0700)]
add Fedora 34 testing to CI

Closes #2059.

3 years agoMerge branch 'smattr/16FA1351-3EE8-4DAB-84C6-E98818C000D1' into 'main'
Matthew Fernandez [Sat, 24 Jul 2021 02:13:42 +0000 (02:13 +0000)]
Merge branch 'smattr/16FA1351-3EE8-4DAB-84C6-E98818C000D1' into 'main'

lib/gvc: [nfc] fix some comment typos

See merge request graphviz/graphviz!2069

3 years agolib/gvc: [nfc] fix some comment typos
Matthew Fernandez [Fri, 23 Jul 2021 04:39:39 +0000 (21:39 -0700)]
lib/gvc: [nfc] fix some comment typos

3 years agoMerge branch 'smattr/5BC8FF91-4894-488A-8212-6A37F2A35ECC' into 'main'
Matthew Fernandez [Sat, 24 Jul 2021 01:12:24 +0000 (01:12 +0000)]
Merge branch 'smattr/5BC8FF91-4894-488A-8212-6A37F2A35ECC' into 'main'

remove RS HPPA header work arounds

See merge request graphviz/graphviz!2068

3 years agorename LS to LSH for consistency with RSH
Matthew Fernandez [Fri, 23 Jul 2021 03:22:34 +0000 (20:22 -0700)]
rename LS to LSH for consistency with RSH

3 years agoremove no longer necessary RS undefine
Matthew Fernandez [Fri, 23 Jul 2021 03:21:07 +0000 (20:21 -0700)]
remove no longer necessary RS undefine

3 years agolib/expr: use RSH as a constant for >> instead of RS
Matthew Fernandez [Fri, 23 Jul 2021 03:18:51 +0000 (20:18 -0700)]
lib/expr: use RSH as a constant for >> instead of RS

A couple of places in the code base are dodging an `RS` symbol apparently
introduced by an HPPA header. It is simpler to just use a symbol that does not
collide at all.

3 years agoMerge branch 'cmansley:cmansley-main-patch-01536' into main
Matthew Fernandez [Sat, 24 Jul 2021 00:07:53 +0000 (17:07 -0700)]
Merge branch 'cmansley:cmansley-main-patch-01536' into main

See merge request graphviz/graphviz!2064

3 years agoInitialize nPasses in aspect_t struct in SetAspect
Chris Mansley [Wed, 21 Jul 2021 19:33:42 +0000 (19:33 +0000)]
Initialize nPasses in aspect_t struct in SetAspect

In dotLayout, nPasses is decremented in a while loop. Since it may be
uninitialized, this triggers clang's UndefinedBehaviorSanitizer:
signed-integer-overflow. While behavior does not change because the loop also
checks nextIter, which is initialized, this change fixes the sanitizer error.

3 years agoMerge branch 'smattr/5c73db2b-d34f-4673-9e8a-b67c3070c221' into 'main'
Matthew Fernandez [Thu, 22 Jul 2021 01:07:34 +0000 (01:07 +0000)]
Merge branch 'smattr/5c73db2b-d34f-4673-9e8a-b67c3070c221' into 'main'

rewrite edgepaint command line parsing using getopt_long

Closes #1971

See merge request graphviz/graphviz!2059

3 years agoedgepaint: more consistently use EXIT_SUCCESS and EXIT_FAILURE when exiting
Matthew Fernandez [Sun, 18 Jul 2021 21:32:47 +0000 (14:32 -0700)]
edgepaint: more consistently use EXIT_SUCCESS and EXIT_FAILURE when exiting

These are more portable than relying on numeric values.

3 years agoedgepaint: remove unused infile
Matthew Fernandez [Sun, 18 Jul 2021 21:26:47 +0000 (14:26 -0700)]
edgepaint: remove unused infile

Surprisingly this is configured but never used. Instead all code accesses the
input file(s) through `Files`.

3 years agoedgepaint: remove mode argument to openFile
Matthew Fernandez [Sun, 18 Jul 2021 21:24:13 +0000 (14:24 -0700)]
edgepaint: remove mode argument to openFile

In edgepaint, this function is only called to open a file in write mode.