]> granicus.if.org Git - graphviz/log
graphviz
2 years agoGD plugin gdgen_end_page: squash -Wmissing-field-initializers warning
Matthew Fernandez [Sat, 20 Aug 2022 03:26:21 +0000 (20:26 -0700)]
GD plugin gdgen_end_page: squash -Wmissing-field-initializers warning

2 years agoMerge branch 'smattr/gitlab-2257' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 17:28:25 +0000 (17:28 +0000)]
Merge branch 'smattr/gitlab-2257' into 'main'

remove $GV_FILE_PATH support

Closes #2257

See merge request graphviz/graphviz!2794

2 years agoremove $GV_FILE_PATH support
Matthew Fernandez [Tue, 16 Aug 2022 02:19:29 +0000 (19:19 -0700)]
remove $GV_FILE_PATH support

The `$GV_FILE_PATH` environment variable could be set to sandbox Graphviz’
ability to read and write to the file system. This made sense once upon a time,
but the world around Graphviz has shifted. Sandboxing yourself is no longer as
valuable a proposition as an external sandboxer that can be more easily audited.
Platforms’ ecosystems have matured to support this use case (Capsicum on
FreeBSD, Seccomp on Linux, App Sandbox on macOS, Pledge on OpenBSD, …).

This change makes any attempt to use `$GV_FILE_PATH` “fail-closed,” in the
sense that execution will be aborted. This may be surprising and not what the
user intended, but this conservatively guarantees safety: you can never think
you have enabled `$GV_FILE_PATH`-based sandboxing and be instead running
unguarded.

Gitlab: closes #2257

2 years agoadd a test case for #2257
Matthew Fernandez [Tue, 16 Aug 2022 01:22:32 +0000 (18:22 -0700)]
add a test case for #2257

2 years agoMerge branch 'smattr/c33cd902-b3b8-4865-847d-ad832d997c4f' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 16:29:09 +0000 (16:29 +0000)]
Merge branch 'smattr/c33cd902-b3b8-4865-847d-ad832d997c4f' into 'main'

start 6.0.0 development

See merge request graphviz/graphviz!2800

2 years agostart 6.0.0 development
Matthew Fernandez [Sat, 20 Aug 2022 14:42:29 +0000 (07:42 -0700)]
start 6.0.0 development

This starts 6.0.0 rather than 5.0.2 because we know we are immediately about to
merge something breaking (`$GV_FILE_PATH` removal).

2 years agoMerge branch 'smattr/859c3111-91ff-44fe-a6ac-f71b9f496f68' into 'main' 5.0.1
Matthew Fernandez [Sat, 20 Aug 2022 15:26:09 +0000 (15:26 +0000)]
Merge branch 'smattr/859c3111-91ff-44fe-a6ac-f71b9f496f68' into 'main'

Stable release 5.0.1

See merge request graphviz/graphviz!2792

2 years agoStable release 5.0.1
Matthew Fernandez [Mon, 15 Aug 2022 00:47:53 +0000 (17:47 -0700)]
Stable release 5.0.1

2 years agoMerge branch 'smattr/f71cbd75-31c7-419f-85ae-1bb310b98b7c' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 03:55:28 +0000 (03:55 +0000)]
Merge branch 'smattr/f71cbd75-31c7-419f-85ae-1bb310b98b7c' into 'main'

sfio and expr: dead code removal

See merge request graphviz/graphviz!2791

2 years agosfio: remove unused 'SF_CLOSE'
Matthew Fernandez [Sun, 14 Aug 2022 22:12:02 +0000 (15:12 -0700)]
sfio: remove unused 'SF_CLOSE'

All Graphviz uses were updated to use `SF_CLOSING` a long time ago.

2 years agosfio: remove unused 'SF_BUFSIZE'
Matthew Fernandez [Sun, 14 Aug 2022 22:08:49 +0000 (15:08 -0700)]
sfio: remove unused 'SF_BUFSIZE'

The last use of this was removed in faee068a9d838f11233b9bd5d33cabb11f07f02b.

2 years agosfio sfpkrd: use a more appropriate type for 'read' result
Matthew Fernandez [Sun, 14 Aug 2022 21:51:28 +0000 (14:51 -0700)]
sfio sfpkrd: use a more appropriate type for 'read' result

Squashes a -Wconversion warning.

2 years agoexpr expush: remove unused string path
Matthew Fernandez [Sun, 14 Aug 2022 21:45:05 +0000 (14:45 -0700)]
expr expush: remove unused string path

As of the previous commit, this is unused.

2 years agoexpr excomp: remove unused string path
Matthew Fernandez [Sun, 14 Aug 2022 21:36:52 +0000 (14:36 -0700)]
expr excomp: remove unused string path

This function could accept either a string or a file handle. But only the file
handle code path is used.

2 years agosfio: make '_sftype' static
Matthew Fernandez [Sun, 14 Aug 2022 21:25:30 +0000 (14:25 -0700)]
sfio: make '_sftype' static

This function is not used outside of its containing file.

2 years agosfio sfopen: remove 'f' parameter that is always 'NULL'
Matthew Fernandez [Sun, 14 Aug 2022 21:21:54 +0000 (14:21 -0700)]
sfio sfopen: remove 'f' parameter that is always 'NULL'

2 years agoMerge branch 'smattr/0e7b46c3-caee-4459-aae9-f9428bae2d84' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 02:10:29 +0000 (02:10 +0000)]
Merge branch 'smattr/0e7b46c3-caee-4459-aae9-f9428bae2d84' into 'main'

graphml2gv: fix error message referring to cvtgxl

See merge request graphviz/graphviz!2798

2 years agographml2gv: fix error message referring to cvtgxl
Matthew Fernandez [Fri, 19 Aug 2022 14:53:34 +0000 (07:53 -0700)]
graphml2gv: fix error message referring to cvtgxl

1d28d7d2b4d2b2551bd1f432aa175f54a69364a4 appears to have copy-pasted much of the
initial code from cmd/tools/cvtgxl.c, accidentally retaining this usage message
referring to the wrong tool.

2 years agoMerge branch 'smattr/2c713249-8784-4e0b-87a1-52cd37e4df45' into 'main'
Matthew Fernandez [Sat, 20 Aug 2022 01:15:46 +0000 (01:15 +0000)]
Merge branch 'smattr/2c713249-8784-4e0b-87a1-52cd37e4df45' into 'main'

smyrna, tclpkg warning squashing

See merge request graphviz/graphviz!2795

2 years agosmyrna glcompui.c: squash unused parameter warnings
Matthew Fernandez [Tue, 16 Aug 2022 04:14:17 +0000 (21:14 -0700)]
smyrna glcompui.c: squash unused parameter warnings

These parameters cannot easily be removed because these functions are used as
callbacks. This change squashes 39 compiler warnings.

2 years agosmyrna topviewsettings.c: rename attribute parameters to avoid shadowing
Matthew Fernandez [Tue, 16 Aug 2022 04:00:58 +0000 (21:00 -0700)]
smyrna topviewsettings.c: rename attribute parameters to avoid shadowing

Squashes 13 -Wshadow warnings.

2 years agoavoid adding non-existent TCL generic path to include directories
Matthew Fernandez [Tue, 16 Aug 2022 03:42:13 +0000 (20:42 -0700)]
avoid adding non-existent TCL generic path to include directories

It looks like a typo in 30f5e6535f21ca671d76159b49cc87add1f0b53e that this was
not adjusted. This change squashes 25 -Wmissing-include-dir warnings.

2 years agotcldot: inline and simplify 'MATCHES_OPTION'
Matthew Fernandez [Tue, 16 Aug 2022 03:35:13 +0000 (20:35 -0700)]
tcldot: inline and simplify 'MATCHES_OPTION'

I guess in the past this was an optimization. In a modern environment this does
little other than obscure the intent of this code.

2 years agoMerge branch 'smattr/6C564655-0DD5-4AEB-8E1D-CBDF3920EFBA' into 'main'
Matthew Fernandez [Fri, 19 Aug 2022 01:39:13 +0000 (01:39 +0000)]
Merge branch 'smattr/6C564655-0DD5-4AEB-8E1D-CBDF3920EFBA' into 'main'

core plugin: some cleanup

See merge request graphviz/graphviz!2789

2 years agocore plugin: replace 'assert(0)' with 'UNREACHABLE()'
Matthew Fernandez [Sat, 13 Aug 2022 15:44:44 +0000 (08:44 -0700)]
core plugin: replace 'assert(0)' with 'UNREACHABLE()'

The latter is more robust and clearer in intent.

2 years agocore plugin: use const arrays for some strings
Matthew Fernandez [Sat, 13 Aug 2022 15:34:45 +0000 (08:34 -0700)]
core plugin: use const arrays for some strings

This makes very little difference to the compiler, as it can see all uses of
these strings. But this makes it clearer to readers that these variables are not
modified. Using an array instead of a pointer slightly increases flexibility,
allowing a useful application of `sizeof` to these variables should we ever want
to do that.

2 years agoMerge branch 'smattr/f6178594-61df-49d2-be88-70eea3c8caed' into 'main'
Matthew Fernandez [Thu, 18 Aug 2022 15:44:00 +0000 (15:44 +0000)]
Merge branch 'smattr/f6178594-61df-49d2-be88-70eea3c8caed' into 'main'

some DEVELOPERS.md tuning and a #2258 test case

See merge request graphviz/graphviz!2793

2 years agoadd a test case for #2258
Matthew Fernandez [Mon, 15 Aug 2022 03:21:13 +0000 (20:21 -0700)]
add a test case for #2258

2 years agoDEVELOPERS.md: add instructions of how to run a single test
Matthew Fernandez [Mon, 15 Aug 2022 03:06:30 +0000 (20:06 -0700)]
DEVELOPERS.md: add instructions of how to run a single test

2 years agoDEVELOPERS.md: remove reference to 'rtest'
Matthew Fernandez [Mon, 15 Aug 2022 03:03:56 +0000 (20:03 -0700)]
DEVELOPERS.md: remove reference to 'rtest'

This directory was removed in 0e19cdb9bff60fdeb1942f5dca677db9d8a24062.

2 years agoDEVELOPERS.md: move how to make a release to the bottom
Matthew Fernandez [Mon, 15 Aug 2022 03:01:14 +0000 (20:01 -0700)]
DEVELOPERS.md: move how to make a release to the bottom

This guide was sort of back-to-front, in that it prioritized readers who were
maintainers looking at cutting an upcoming release. In reality, this document is
read far more often by drive-by contributors seeking how to build and test their
changes.

2 years agoDEVELOPERS.md: drop TODO about updating example commits
Matthew Fernandez [Mon, 15 Aug 2022 02:59:29 +0000 (19:59 -0700)]
DEVELOPERS.md: drop TODO about updating example commits

Despite coming up on 5.0.1, we have not updated the example commits since
2.44.1. This seems like strong evidence that the existing examples are
sufficient.

2 years agoMerge branch 'smattr/a49270af-5a27-474a-be22-ef9418667c79' into 'main'
Matthew Fernandez [Thu, 18 Aug 2022 04:35:49 +0000 (04:35 +0000)]
Merge branch 'smattr/a49270af-5a27-474a-be22-ef9418667c79' into 'main'

cgraph: rewrite scanner to use an agxbuf

See merge request graphviz/graphviz!2788

2 years agocgraph: rewrite scanner to use an agxbuf
Matthew Fernandez [Sat, 13 Aug 2022 01:28:09 +0000 (18:28 -0700)]
cgraph: rewrite scanner to use an agxbuf

In a sort of Chesterton’s fence¹ sense, I do not understand the existing code.
While I understand the first order motivation (dynamic string buffering inline),
I do not follow the implementation. It manages to hit the trifecta:

  1. NULL pointer dereference. Failures of allocation functions were not
     checked.

  2. Memory leaks. Calls to `agstrdup` and `agstrdup_html` allocate an owned
     string internally, yet this code was acting as if they stole the `Sbuf`
     backing memory.

  3. Not-obviously-correct and repeated computation of the end of the buffer to
     append to. `addstr` seemed overly complex and inefficient.

Static initialization of an agxbuf was a bit complicated until
04a248348798a4a32fc9ac7e5d860a84ab5ee49f, though it was still possible.
Following that commit, it becomes a no-brainer.

The code after this change still leaks memory. Perhaps in future we should reset
(`agxbfree(&Sbuf); memset(&Sbuf, 0, sizeof(Sbuf));`) the buffer after `agstrdup`
or `agstrdup_html`, though there would be a performance cost to this.

¹ https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_fence

2 years agocgraph delete_items: rephrase a non-exhaustive switch into if statements
Matthew Fernandez [Sat, 13 Aug 2022 00:50:11 +0000 (17:50 -0700)]
cgraph delete_items: rephrase a non-exhaustive switch into if statements

This is both more concise and squashes a -Wswitch-default warning.

2 years agocgraph: make 'agflatten_edges' static
Matthew Fernandez [Sat, 13 Aug 2022 00:41:17 +0000 (17:41 -0700)]
cgraph: make 'agflatten_edges' static

This function is not used outside of its containing file. Squashes a
-Wmissing-prototypes warning.

2 years agoMerge branch 'extend-svg-analyzer-with-basic-svg-re-creation' into 'main'
Magnus Jacobsson [Tue, 16 Aug 2022 11:16:17 +0000 (11:16 +0000)]
Merge branch 'extend-svg-analyzer-with-basic-svg-re-creation' into 'main'

Extend the SVG analyzer with basic SVG re-creation

See merge request graphviz/graphviz!2780

2 years agotests: svgAnalyzer: add throwing of exceptions for unimplemented attributes
Magnus Jacobsson [Sat, 30 Jul 2022 15:31:03 +0000 (17:31 +0200)]
tests: svgAnalyzer: add throwing of exceptions for unimplemented attributes

2 years agotests: SvgAnalyzer: add handling of the 'd' attribute
Magnus Jacobsson [Thu, 28 Jul 2022 10:58:49 +0000 (12:58 +0200)]
tests: SvgAnalyzer: add handling of the 'd' attribute

2 years agotests: SvgAnalyzer: add handling of the 'font-size' attribute
Magnus Jacobsson [Thu, 28 Jul 2022 10:13:08 +0000 (12:13 +0200)]
tests: SvgAnalyzer: add handling of the 'font-size' attribute

2 years agotests: SvgAnalyzer: add handling of the 'font-family' attribute
Magnus Jacobsson [Thu, 28 Jul 2022 10:00:50 +0000 (12:00 +0200)]
tests: SvgAnalyzer: add handling of the 'font-family' attribute

2 years agotests: SvgAnalyzer: add handling of the 'x' and 'y' attributes
Magnus Jacobsson [Thu, 28 Jul 2022 08:43:07 +0000 (10:43 +0200)]
tests: SvgAnalyzer: add handling of the 'x' and 'y' attributes

2 years agotests: SvgAnalyzer: add handling of the 'text-anchor' attribute
Magnus Jacobsson [Thu, 28 Jul 2022 08:27:29 +0000 (10:27 +0200)]
tests: SvgAnalyzer: add handling of the 'text-anchor' attribute

2 years agotests: SvgAnalyzer: add handling of the 'rx' and 'ry' attributes
Magnus Jacobsson [Wed, 27 Jul 2022 20:07:08 +0000 (22:07 +0200)]
tests: SvgAnalyzer: add handling of the 'rx' and 'ry' attributes

2 years agotests: SvgAnalyzer: add handling of the 'cx' and 'cy' attributes
Magnus Jacobsson [Wed, 27 Jul 2022 19:42:19 +0000 (21:42 +0200)]
tests: SvgAnalyzer: add handling of the 'cx' and 'cy' attributes

2 years agotests: SvgAnalyzer: add handling of the 'points' attribute
Magnus Jacobsson [Wed, 27 Jul 2022 14:17:28 +0000 (16:17 +0200)]
tests: SvgAnalyzer: add handling of the 'points' attribute

2 years agogvrender_core_svg: remove unnecessary space in the 'points' attribute for polyline
Magnus Jacobsson [Mon, 1 Aug 2022 11:27:38 +0000 (13:27 +0200)]
gvrender_core_svg: remove unnecessary space in the 'points' attribute for polyline

2 years agotests: SvgAnalyzer: add handling of the 'stroke' attribute
Magnus Jacobsson [Wed, 27 Jul 2022 13:40:08 +0000 (15:40 +0200)]
tests: SvgAnalyzer: add handling of the 'stroke' attribute

2 years agotests: SvgAnalyzer: add handling of the 'fill' attribute
Magnus Jacobsson [Wed, 27 Jul 2022 12:28:44 +0000 (14:28 +0200)]
tests: SvgAnalyzer: add handling of the 'fill' attribute

2 years agotests: SvgAnalyzer: add handling of the 'transform' attribute
Magnus Jacobsson [Wed, 27 Jul 2022 10:40:42 +0000 (12:40 +0200)]
tests: SvgAnalyzer: add handling of the 'transform' attribute

2 years agotests: SvgAnalyzer: add handling of the 'id' attribute
Magnus Jacobsson [Wed, 27 Jul 2022 09:05:08 +0000 (11:05 +0200)]
tests: SvgAnalyzer: add handling of the 'id' attribute

2 years agotests: SvgAnalyzer: add generation of the 'xmlns' and' xmlns:xlink' attributes
Magnus Jacobsson [Tue, 26 Jul 2022 19:40:01 +0000 (21:40 +0200)]
tests: SvgAnalyzer: add generation of the 'xmlns' and' xmlns:xlink' attributes

2 years agotests: SvgAnalyzer: add handling of the 'viewBox' attribute
Magnus Jacobsson [Tue, 26 Jul 2022 18:51:08 +0000 (20:51 +0200)]
tests: SvgAnalyzer: add handling of the 'viewBox' attribute

2 years agotests: SvgAnalyzer: add handling of the 'width' and 'height' attributes
Magnus Jacobsson [Tue, 26 Jul 2022 13:22:29 +0000 (15:22 +0200)]
tests: SvgAnalyzer: add handling of the 'width' and 'height' attributes

2 years agotests: SvgAnalyzer: add node and edge ID comments to the recreated SVG
Magnus Jacobsson [Fri, 29 Jul 2022 14:07:37 +0000 (16:07 +0200)]
tests: SvgAnalyzer: add node and edge ID comments to the recreated SVG

2 years agotests: SvgAnalyzer: add handling of the 'class' attribute
Magnus Jacobsson [Sat, 23 Jul 2022 10:50:06 +0000 (12:50 +0200)]
tests: SvgAnalyzer: add handling of the 'class' attribute

This will be used in an upcoming commit to identify Graphviz graphs,
nodes and edges.

2 years agotests: SvgAnalyzer: add comment with graph title (ID) to the recreated SVG
Magnus Jacobsson [Wed, 27 Jul 2022 12:28:44 +0000 (14:28 +0200)]
tests: SvgAnalyzer: add comment with graph title (ID) to the recreated SVG

2 years agotests: SvgAnalyzer: add storage of the Graphviz graph ID also on 'svg' element
Magnus Jacobsson [Fri, 29 Jul 2022 13:55:27 +0000 (15:55 +0200)]
tests: SvgAnalyzer: add storage of the Graphviz graph ID also on 'svg' element

2 years agotests: SvgAnalyzer: add storage of the Graphviz component ID on 'g' elements
Magnus Jacobsson [Mon, 25 Jul 2022 07:02:15 +0000 (09:02 +0200)]
tests: SvgAnalyzer: add storage of the Graphviz component ID on 'g' elements

2 years agotests: SvgAnalyzer: add Graphviz version and build date to the generated SVG string
Magnus Jacobsson [Mon, 25 Jul 2022 14:00:31 +0000 (16:00 +0200)]
tests: SvgAnalyzer: add Graphviz version and build date to the generated SVG string

2 years agogvc++: add GVContext::buildDate()
Magnus Jacobsson [Mon, 7 Mar 2022 12:37:54 +0000 (13:37 +0100)]
gvc++: add GVContext::buildDate()

2 years agogvc++: add GVContext::version()
Magnus Jacobsson [Mon, 7 Mar 2022 12:32:07 +0000 (13:32 +0100)]
gvc++: add GVContext::version()

2 years agotests: SvgAnalyzer: add handling of SVG element text node contents
Magnus Jacobsson [Mon, 25 Jul 2022 06:49:33 +0000 (08:49 +0200)]
tests: SvgAnalyzer: add handling of SVG element text node contents

2 years agotests: SvgAnalyzer: add handling of 'text' elements
Magnus Jacobsson [Sun, 24 Jul 2022 20:26:32 +0000 (22:26 +0200)]
tests: SvgAnalyzer: add handling of 'text' elements

2 years agotests: SvgAnalyzer: add an svg_string method
Magnus Jacobsson [Thu, 28 Jul 2022 11:56:26 +0000 (13:56 +0200)]
tests: SvgAnalyzer: add an svg_string method

2 years agotests: SvgAnalyzer: add internal re-creation of the SVG element hierarchy
Magnus Jacobsson [Thu, 21 Jul 2022 11:16:41 +0000 (13:16 +0200)]
tests: SvgAnalyzer: add internal re-creation of the SVG element hierarchy

This will be used in upcoming commits in this series to store
attributes on and to re-create the original SVG from. Also, an
upcoming commit series will extend the SVG analyzer to be aware of
Graphviz graphs, nodes and edges and will use this hierarchy and the
associated attributes to be able to answer questions about their
properties.

2 years agotests: add new test_svg_analyzer test skeleton
Magnus Jacobsson [Thu, 21 Jul 2022 11:16:41 +0000 (13:16 +0200)]
tests: add new test_svg_analyzer test skeleton

Upcoming commits will add functionality to the SVG analyzer and extend
this test.

2 years agotests: svgAnalyzer: remove useless const on pass-by-value parameter declarations
Magnus Jacobsson [Sun, 14 Aug 2022 15:03:58 +0000 (17:03 +0200)]
tests: svgAnalyzer: remove useless const on pass-by-value parameter declarations

2 years agotests: SvgAnalyzer: remove unused parameter names instead of void casting them to...
Magnus Jacobsson [Wed, 27 Jul 2022 09:37:20 +0000 (11:37 +0200)]
tests: SvgAnalyzer: remove unused parameter names instead of void casting them to avoid warnings

2 years agotests: svgAnalyzer: remove useless handling of 'any' SVG element
Magnus Jacobsson [Tue, 2 Aug 2022 14:26:00 +0000 (16:26 +0200)]
tests: svgAnalyzer: remove useless handling of 'any' SVG element

We haven't asked SVG++ to be called back for any element, just for
explicitly specified elements. Therefore we will never receive any
unknown elements that the SVG analyzer could count so this
functionality is also removed.

2 years agotests: SvgAnalyzer: remove useless extra 'private' access specifier
Magnus Jacobsson [Wed, 3 Aug 2022 08:28:13 +0000 (10:28 +0200)]
tests: SvgAnalyzer: remove useless extra 'private' access specifier

2 years agoMerge branch 'markhnsn-main-patch-73982' into 'main'
Matthew Fernandez [Sun, 14 Aug 2022 18:03:38 +0000 (18:03 +0000)]
Merge branch 'markhnsn-main-patch-73982' into 'main'

Replace wrong 'CELLSBORDER' in error message

See merge request graphviz/graphviz!2790

2 years agoReplace wrong 'CELLSBORDER' in error message
Mark Hansen [Sat, 13 Aug 2022 19:49:59 +0000 (19:49 +0000)]
Replace wrong 'CELLSBORDER' in error message

Should be 'CELLBORDER'.

See rationale at
https://gitlab.com/graphviz/graphviz.gitlab.io/-/issues/158

2 years agoMerge branch 'smattr/5768cfa8-e3ed-4e0f-b0e1-79f061a886cf' into 'main'
Matthew Fernandez [Sat, 13 Aug 2022 18:24:47 +0000 (18:24 +0000)]
Merge branch 'smattr/5768cfa8-e3ed-4e0f-b0e1-79f061a886cf' into 'main'

gvpr: remove long lived scratch SFIO buffer

See merge request graphviz/graphviz!2784

2 years agogvpr: remove 'Gpr_t.tmp'
Matthew Fernandez [Sun, 7 Aug 2022 17:30:23 +0000 (10:30 -0700)]
gvpr: remove 'Gpr_t.tmp'

As of the previous commit, this is no longer used.

Gitlab: #1873

2 years agogvpr colorx: use a local agxbuf instead of GVPR state’s 'tmp'
Matthew Fernandez [Sun, 7 Aug 2022 17:25:32 +0000 (10:25 -0700)]
gvpr colorx: use a local agxbuf instead of GVPR state’s 'tmp'

This makes it clearer to both humans and the compiler that the data written to
this buffer is not required beyond this function. This also gets us closer to
removing an SFIO dependency.

Gitlab: #1873

2 years agogvpr lookup: remove now unused 'state' parameter
Matthew Fernandez [Sun, 7 Aug 2022 17:15:11 +0000 (10:15 -0700)]
gvpr lookup: remove now unused 'state' parameter

2 years agoexpr: remove now unused 'disc' parameter to 'Exdisc_t.stringof'
Matthew Fernandez [Sun, 7 Aug 2022 17:10:43 +0000 (10:10 -0700)]
expr: remove now unused 'disc' parameter to 'Exdisc_t.stringof'

2 years agogvpr nameOf: use an agxbuf instead of SFIO stream
Matthew Fernandez [Sun, 7 Aug 2022 17:05:19 +0000 (10:05 -0700)]
gvpr nameOf: use an agxbuf instead of SFIO stream

This makes it clearer to both humans and the compiler that the data written to
this buffer has a much more constrained scope than was previously implied. This
also gets us closer to removing an SFIO dependency.

Gitlab: #1873

2 years agogvpr compile.c: wrap some long lines
Matthew Fernandez [Sun, 7 Aug 2022 16:47:02 +0000 (09:47 -0700)]
gvpr compile.c: wrap some long lines

This will make an upcoming change more readable.

2 years agogvpr traverse: use a local agxbuf instead of GVPR state’s 'tmp'
Matthew Fernandez [Sun, 7 Aug 2022 16:42:49 +0000 (09:42 -0700)]
gvpr traverse: use a local agxbuf instead of GVPR state’s 'tmp'

This makes it clearer to both humans and the compiler that the data written to
this buffer is not required beyond this function. This also gets us closer to
removing an SFIO dependency.

Gitlab: #1873

2 years agogvpr toUpper: rewrite to use a single buffer
Matthew Fernandez [Sun, 7 Aug 2022 16:31:24 +0000 (09:31 -0700)]
gvpr toUpper: rewrite to use a single buffer

`toUpper` worked by using the GVPR state’s temporary buffer, `tmp`, to
incrementally construct an uppercase copy of the input. This works but is
suboptimal. When printing to the temporary buffer, it has no knowledge of what
we are up to and needs to make heuristic-based decisions on how to allocate
memory. But we know the exact size of the result string already. This commit
takes advantage of this knowledge and allocates the destination memory upfront
and then simply writes directly into it. By doing this, we reduce heap pressure
and eliminate an intermediate copying operation.

This commit also renames the `s` parameter to something more descriptive.

Gitlab: #1873

2 years agogvpr toLower: rewrite to use a single buffer
Matthew Fernandez [Sun, 7 Aug 2022 16:24:43 +0000 (09:24 -0700)]
gvpr toLower: rewrite to use a single buffer

`toLower` worked by using the GVPR state’s temporary buffer, `tmp`, to
incrementally construct a lowercase copy of the input. This works but is
suboptimal. When printing to the temporary buffer, it has no knowledge of what
we are up to and needs to make heuristic-based decisions on how to allocate
memory. But we know the exact size of the result string already. This commit
takes advantage of this knowledge and allocates the destination memory upfront
and then simply writes directly into it. By doing this, we reduce heap pressure
and eliminate an intermediate copying operation.

This commit also renames the `s` parameter to something more descriptive.

Gitlab: #1873

2 years agoMerge branch 'svg-1.1-compliance' into 'main'
Matthew Fernandez [Sat, 13 Aug 2022 16:14:12 +0000 (16:14 +0000)]
Merge branch 'svg-1.1-compliance' into 'main'

Use "none" instead of "transparent" when painting in SVG

See merge request graphviz/graphviz!2472

2 years agoUse "none" instead of "transparent" when painting in SVG
Roger Nesbitt [Wed, 23 Feb 2022 16:42:25 +0000 (05:42 +1300)]
Use "none" instead of "transparent" when painting in SVG

The SVG 1.1 spec, which SVGs generated by gvrender_core_svg.c are
labeled as, does not have the color "transparent" available which is
causing issues with SVG 1.1 parsers.

When specifying paint in the fill or stroke attributes, use "none"
instead of "transparent".  When specifying a gradient color that has
zero opacity, use that color at zero opacity instead of "transparent".
When specifying a gradient with the graphviz transparent color, use
a zero-opacity black as this is how SVG interprets "transparent" in
gradients in SVG 2.0.

2 years agoMerge branch 'lib' into 'main'
Matthew Fernandez [Sat, 13 Aug 2022 03:16:34 +0000 (03:16 +0000)]
Merge branch 'lib' into 'main'

add doxygen comments to some lib directories

See merge request graphviz/graphviz!2762

2 years agoupdate cdt comment
Costa Shulyupin [Fri, 15 Jul 2022 05:29:45 +0000 (08:29 +0300)]
update cdt comment

2 years agovpsc doxygen comment
Costa Shulyupin [Fri, 15 Jul 2022 05:29:04 +0000 (08:29 +0300)]
vpsc doxygen comment

2 years agopathplan doxygen comments
Costa Shulyupin [Fri, 15 Jul 2022 05:28:13 +0000 (08:28 +0300)]
pathplan doxygen comments

2 years agolib/pack doxygen comments
Costa Shulyupin [Fri, 15 Jul 2022 05:26:42 +0000 (08:26 +0300)]
lib/pack doxygen comments

2 years agoGraphviz context library doxygen comments
Costa Shulyupin [Fri, 15 Jul 2022 04:52:12 +0000 (07:52 +0300)]
Graphviz context library doxygen comments

2 years agoMerge branch 'smattr/66e9b6f5-ee5b-43b3-ab61-435db8059def' into 'main'
Matthew Fernandez [Fri, 12 Aug 2022 05:23:50 +0000 (05:23 +0000)]
Merge branch 'smattr/66e9b6f5-ee5b-43b3-ab61-435db8059def' into 'main'

some agxbuf fixing and design polishing

See merge request graphviz/graphviz!2786

2 years agogvc gvPluginList: abbreviate an open coded 'strview_str'
Matthew Fernandez [Thu, 11 Aug 2022 02:35:17 +0000 (19:35 -0700)]
gvc gvPluginList: abbreviate an open coded 'strview_str'

2 years agoabbreviate 'agxbdisown' usage and remove 'agxbfree' calls
Matthew Fernandez [Thu, 11 Aug 2022 02:33:00 +0000 (19:33 -0700)]
abbreviate 'agxbdisown' usage and remove 'agxbfree' calls

As discussed in the previous commit, `agxbfree` following an `agxbdisown` is no
longer necessary.

2 years agocgraph agxbdisown: exit on allocation failure instead of returning NULL
Matthew Fernandez [Thu, 11 Aug 2022 02:14:08 +0000 (19:14 -0700)]
cgraph agxbdisown: exit on allocation failure instead of returning NULL

82b7d2021a7faa565065804df8b730a3213a8356 abbreviated some xdot code into a call
to `agxbdisown`. But it failed to account for the fact that `agxbdisown` could
return `NULL` on `strdup` failure, leaving still-allocated memory in the agxbuf.
Thus this commit introduced a new code path that leaked memory. I.e. the removed
call to `agxbfree` should have been retained.

So the obvious fix would be to re-add the `agxbfree` call, right? Well closer
inspection of agxbuf reveals another incongruity. agxbuf takes design decisions
based on the idea that the caller either cannot handle failure or does not want
to handle failure. It calls the alloc.h wrappers that exit on out-of-memory,
alleviating the caller from having to think about such things. Except for one
case: calling `strdup` in `agxbdisown`. Here it assumes the caller _does_ want
to handle failure. Except actually not, because it previously calls `agxbputc`
that conditionally calls `agxbmore` that exits on allocation failure. This is a
bit convoluted, but putting this all together we can see that the caller of
`agxbdisown` actually _cannot_ robustly recover from failure because, even if
they try to, `agxbmore` can still exit before they have a chance.

The way out of this quagmire is to adhere to the original principle more
strongly in `agxbdisown`. We assume, here too, that the caller does not want to
or cannot handle failure. `agxbdisown` now exits on all allocation failure
paths.

This has two coincidental beneficial side effects:

  1. In one case, we can leverage `gv_strndup` to avoid writing a trailing
     `'\0'` that is only for the purposes of immediately copying it somewhere
     else.

  2. Any caller of `agxbdisown` no longer needs to call `agxbfree` afterwards.
     In an analogy to C++, `agxbdisown` is effectively a move operator and
     destructor in one.

2 years agocgraph: clang-format agxbuf.h
Matthew Fernandez [Thu, 11 Aug 2022 02:05:53 +0000 (19:05 -0700)]
cgraph: clang-format agxbuf.h

We do not usually reformat existing code unless it is otherwise being edited.
But in this case the file was so close to compliant already, it seems worth it.

2 years agoMerge branch 'smattr/8EEAED96-8A05-4124-86F0-C7288D4113A6' into 'main'
Matthew Fernandez [Fri, 12 Aug 2022 04:26:25 +0000 (04:26 +0000)]
Merge branch 'smattr/8EEAED96-8A05-4124-86F0-C7288D4113A6' into 'main'

stop selectively disabling compiler optimization for MinGW

See merge request graphviz/graphviz!2787

2 years agostop selectively disabling compiler optimization for MinGW
Matthew Fernandez [Thu, 11 Aug 2022 02:54:43 +0000 (19:54 -0700)]
stop selectively disabling compiler optimization for MinGW

I do not know why these lines are here and the originating commit messages do
not explain either. Lets remove them and see what (if anything) breaks.

2 years agoMerge branch 'smattr/8eaea08d-5afc-48f7-a2f0-09cbc5a07181' into 'main'
Matthew Fernandez [Wed, 10 Aug 2022 16:46:07 +0000 (16:46 +0000)]
Merge branch 'smattr/8eaea08d-5afc-48f7-a2f0-09cbc5a07181' into 'main'

xdot warning squashing and some simplification

See merge request graphviz/graphviz!2785

2 years agoxdot parsePolyline: standardize on returning 'NULL' instead of '0'
Matthew Fernandez [Wed, 10 Aug 2022 15:49:06 +0000 (08:49 -0700)]
xdot parsePolyline: standardize on returning 'NULL' instead of '0'