]> granicus.if.org Git - graphviz/log
graphviz
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'

2 years agoxdot: fuse adjacent 'print' calls
Matthew Fernandez [Wed, 10 Aug 2022 02:20:33 +0000 (19:20 -0700)]
xdot: fuse adjacent 'print' calls

This leads to shorter and more efficient code.

2 years agoxdot: inline and specialize 'printInt'
Matthew Fernandez [Wed, 10 Aug 2022 02:07:03 +0000 (19:07 -0700)]
xdot: inline and specialize 'printInt'

Squashes 8 compiler warnings and leads to simpler code.

2 years agoxdot: pass around a printf-like callback instead of fputs-like callback
Matthew Fernandez [Wed, 10 Aug 2022 01:45:44 +0000 (18:45 -0700)]
xdot: pass around a printf-like callback instead of fputs-like callback

This simplifies code, improves flexibility, and removes the need for some
intermediate buffers.

2 years agoxdot printAlign: squash -Wswitch-default warning
Matthew Fernandez [Wed, 10 Aug 2022 00:53:26 +0000 (17:53 -0700)]
xdot printAlign: squash -Wswitch-default warning

This switch is exhaustive.

2 years agoxdot parseXDotFOn: squash -Wsign-compare warning
Matthew Fernandez [Wed, 10 Aug 2022 00:44:27 +0000 (17:44 -0700)]
xdot parseXDotFOn: squash -Wsign-compare warning

2 years agoxdot parseString: squash -Wconversion warings
Matthew Fernandez [Wed, 10 Aug 2022 00:43:24 +0000 (17:43 -0700)]
xdot parseString: squash -Wconversion warings

`i` is known non-negative here.

2 years agoxdot parsePolyline: squash -Wconversion warning
Matthew Fernandez [Wed, 10 Aug 2022 00:39:45 +0000 (17:39 -0700)]
xdot parsePolyline: squash -Wconversion warning

This code parses an int, but then uses it to allocate an array, so clearly
should take the error path when the parsed int is negative.

2 years agoMerge branch 'smattr/b9770144-a277-4aac-8c6c-16d7b2b42a85' into 'main'
Matthew Fernandez [Wed, 10 Aug 2022 15:45:36 +0000 (15:45 +0000)]
Merge branch 'smattr/b9770144-a277-4aac-8c6c-16d7b2b42a85' into 'main'

gvpr warning squashing

See merge request graphviz/graphviz!2783

2 years agogvpr parseProg: squash -Wswitch-default warning
Matthew Fernandez [Sun, 7 Aug 2022 03:41:18 +0000 (20:41 -0700)]
gvpr parseProg: squash -Wswitch-default warning

This switch is exhaustive.

2 years agogvpr parseCase: squash -Wswitch-default warning
Matthew Fernandez [Sun, 7 Aug 2022 03:39:42 +0000 (20:39 -0700)]
gvpr parseCase: squash -Wswitch-default warning

This switch is exhaustive.

2 years agogvpr: cast values when calling 'endBracket'
Matthew Fernandez [Sun, 7 Aug 2022 03:34:16 +0000 (20:34 -0700)]
gvpr: cast values when calling 'endBracket'

Squashes 2 -Wconversion warnings and we know `c` is a char here.

2 years agogvpr: cast values when calling endString
Matthew Fernandez [Sun, 7 Aug 2022 03:30:01 +0000 (20:30 -0700)]
gvpr: cast values when calling endString

Squashes a -Wconversion warning and we know `c` is a char here.

2 years agoMerge branch 'smattr/3a899209-8743-447d-99f9-2c4a3a145265' into 'main'
Matthew Fernandez [Mon, 8 Aug 2022 15:54:50 +0000 (15:54 +0000)]
Merge branch 'smattr/3a899209-8743-447d-99f9-2c4a3a145265' into 'main'

cgraph: minor agxbuf ergonomics improvement

See merge request graphviz/graphviz!2782

2 years agoreplace NULL-hinted agxbuf usage with zero initialization
Matthew Fernandez [Sat, 30 Jul 2022 00:24:05 +0000 (17:24 -0700)]
replace NULL-hinted agxbuf usage with zero initialization

This leads to easy to read code and fewer things for the caller to think about.
I think this should probably become the default pattern for agxbuf usage for the
cases where the data you are printing is unpredictable or you are unsure.

2 years agocgraph: rename 'agxbuf.dyna' and flip its polarity
Matthew Fernandez [Sat, 30 Jul 2022 00:24:05 +0000 (17:24 -0700)]
cgraph: rename 'agxbuf.dyna' and flip its polarity

On the surface, this change looks a little odd – why care about what bit means
what in an internal field of a data structure? But this has an interesting side
effect. After this change, the zeroed state of an agxbuf is a valid 0-sized
dynamically allocated buffer, the same as the end state after `agxbdisown`. In
other words, C99 zero initialization (`agxbuf xb = {0}`) now defines a
reasonably “default” agxbuf state. This gives you all the benefits of the
previous “I don’t know how long my data will be so I’ll just use `BUFSIZ` as a
hint” approach with less typing and less hard coding. The next commit will roll
this out for some simplification in agxbuf usage.

2 years agocgraph agxbput_n: take an early exit when input string is zero
Matthew Fernandez [Sun, 7 Aug 2022 02:52:18 +0000 (19:52 -0700)]
cgraph agxbput_n: take an early exit when input string is zero

An upcoming change makes it possible to enter this function with `xb->ptr` as
`NULL`. It looks as if there is nothing wrong with this; a zero-sized string
fits in any agxbuf, including an unallocated one. However UBSan educates us that
calling `memcpy` with a `NULL` destination pointer is undefined behavior, even
when the passed size is 0. So this change avoids reaching `memcpy` when we know
the function will be a no-op.

Note that this is sort of fixing a latent bug, in that an agxbuf user could
already cause the scenario described above by `agxbdisown`ing an agxbuf and then
calling `agxbput_n` on it with size 0. However no existing callers do this.

2 years agocgraph: when an agxbuf to be expanded has 0 size, expand by 'BUFSIZ'
Matthew Fernandez [Sat, 30 Jul 2022 00:24:05 +0000 (17:24 -0700)]
cgraph: when an agxbuf to be expanded has 0 size, expand by 'BUFSIZ'

When calling `agxbmore` on a 0-sized buffer, the new size to expand to would be
chosen based on the length of the current string being appended. This string
often originated from user’s input graph and hence its length was often
user-defined. There is nothing strictly wrong with this, but it is a little
unpredictable and sometimes leads to pathological outcomes, e.g:

  agxbputc(&xb, 'a'); // expands 0-sized buffer to 1
  agxbputc(&xb, 'b'); // doubles 1-sized buffer to 2
  agxbputc(&xb, 'c'); // doubles 2-sized buffer to 4
  agxbputc(&xb, 'd');
  agxbputc(&xb, 'e'); // doubles 4-sized buffer to 8
  …

This is functionally correct, but that is a lot of `realloc` calls just to
accrue 5 bytes.¹ It is more convenient to enlarge our initial allocation to
something matching the default hint when an agxbuf is initialized.

The situation described above has not typically been a concern in the past
because a 0-sized agxbuf is hard to obtain to begin with. You need to either
call `agxbinit` while supplying your own backing storage that also has 0 size
(why would you do this?) or reuse an agxbuf after `agxbdisown` (technically
legal, but no good reason to do this). Neither of these scenarios occur anywhere
in the Graphviz tree to my knowledge. However an upcoming change will make
0-sized agxbufs more common.

¹ Some of these `realloc`s are likely no-ops, as the system allocator generally
  does not give you exactly 1 byte when you ask for 1. It will probably give you
  more and then when you ask to double to 2, it will tell you your existing
  pointer is just fine to keep on using. But the agxbuf code does not know any
  of these details and will still repeatedly call into `realloc`.

2 years agoMerge branch 'smattr/2BE494E7-8D54-4DBE-BAED-2190AF488504' into 'main'
Matthew Fernandez [Mon, 8 Aug 2022 14:56:43 +0000 (14:56 +0000)]
Merge branch 'smattr/2BE494E7-8D54-4DBE-BAED-2190AF488504' into 'main'

remove dotty, lefty, lneato

Closes #552 and #219

See merge request graphviz/graphviz!2779

2 years agoremove dotty, lefty, lneato
Matthew Fernandez [Wed, 3 Aug 2022 02:40:15 +0000 (19:40 -0700)]
remove dotty, lefty, lneato

Lefty, and its dependent tools Dotty and Lneato, have been suspected unused for
a long time. They were scheduled for removal, but we took a cautious and very
slow approach to this given how pervasive Graphviz is and the limited visibility
we have into its usage:

  1. 2021-09-25 make Lefty default to disabled in the build system¹
  2. 2022-01-16 disable Lefty in published graphviz.org packages²
  3. 2022-03-28 remove build system support³

This completes the final step of removing the code from the repository. It is
still retained in the history, should anyone need access to it or need to build
a past version of Graphviz with Lefty.

So far, we have only heard two notable reactions from the downstream world:

  1. Lefty disabling was not quite complete on the first attempt.⁴
  2. There has been an offer of assistance to maintain Lefty.⁵ No patches have
     yet emerged, but if and when they do we could feasibly reverse direction on
     this and reinstate Lefty and friends.

Gitlab: closes #219, closes #552, related to #1836, #1854

¹ 1a4ad00b59cc1e1e9302fcbd1a205495ee59cab5
² 04a78cc9ae01b2a7e5d5435146cd503c45af90b9
³ 6faa34010f947510ec129af2d998614de8a513ed
⁴ https://gitlab.com/graphviz/graphviz/-/issues/2153
⁵ https://forum.graphviz.org/t/lefty-not-a-graphviz-application/835/6

2 years agoremove legacy Dotty, Lefty, Lneato references from man pages
Matthew Fernandez [Wed, 3 Aug 2022 03:06:43 +0000 (20:06 -0700)]
remove legacy Dotty, Lefty, Lneato references from man pages

2 years agogvpr endString: squash -Wconversion warning
Matthew Fernandez [Sun, 7 Aug 2022 03:28:51 +0000 (20:28 -0700)]
gvpr endString: squash -Wconversion warning

`c` is known to be a character here.

2 years agogvpr parseID: squash -Wconversion warnings
Matthew Fernandez [Sun, 7 Aug 2022 03:27:43 +0000 (20:27 -0700)]
gvpr parseID: squash -Wconversion warnings

`c` is known to be a character here.

2 years agogvpr pop: remove 'delete' parameter that is always 1 and unused 'head'
Matthew Fernandez [Sun, 7 Aug 2022 03:21:45 +0000 (20:21 -0700)]
gvpr pop: remove 'delete' parameter that is always 1 and unused 'head'

2 years agogvpr freef: squash -Wunused-parameter warnings
Matthew Fernandez [Sun, 7 Aug 2022 03:16:19 +0000 (20:16 -0700)]
gvpr freef: squash -Wunused-parameter warnings

These cannot easily be removed because this function is used as a callback.

2 years agogvpr makef: squash -Wunused-parameter warnings
Matthew Fernandez [Sun, 7 Aug 2022 03:15:42 +0000 (20:15 -0700)]
gvpr makef: squash -Wunused-parameter warnings

These cannot easily be removed because this function is used as a callback.

2 years agoMerge branch 'smattr/03db530d-2fe9-47e3-b566-bda45c2928ce' into 'main'
Matthew Fernandez [Sat, 6 Aug 2022 19:13:43 +0000 (19:13 +0000)]
Merge branch 'smattr/03db530d-2fe9-47e3-b566-bda45c2928ce' into 'main'

expr: replace 'exdump' SFIO buffer with an 'agxbuf'

See merge request graphviz/graphviz!2781

2 years agoexpr: remove unused parameters from 'Exdisc_t.matchf'
Matthew Fernandez [Fri, 5 Aug 2022 04:43:03 +0000 (21:43 -0700)]
expr: remove unused parameters from 'Exdisc_t.matchf'

I guess when I committed 260f650085eb25b5b68c81a5960232d025fb6942 it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove unused parameters from 'Exdisc_t.setf'
Matthew Fernandez [Fri, 5 Aug 2022 04:35:28 +0000 (21:35 -0700)]
expr: remove unused parameters from 'Exdisc_t.setf'

I guess when I committed 5b4de3922a2f169c2e773ffe85651898aedd9351 it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.keyf'
Matthew Fernandez [Fri, 5 Aug 2022 04:29:21 +0000 (21:29 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.keyf'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove unused parameters from 'Exdisc_t.keyf'
Matthew Fernandez [Fri, 5 Aug 2022 04:28:01 +0000 (21:28 -0700)]
expr: remove unused parameters from 'Exdisc_t.keyf'

I guess when I committed 2e9753d9c9886f5bc013212420528e9a18bc592b it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.stringof'
Matthew Fernandez [Fri, 5 Aug 2022 04:23:19 +0000 (21:23 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.stringof'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.typename'
Matthew Fernandez [Fri, 5 Aug 2022 04:21:45 +0000 (21:21 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.typename'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove unused 'pg' parameter from 'Exdisc_t.typename'
Matthew Fernandez [Fri, 5 Aug 2022 04:20:54 +0000 (21:20 -0700)]
expr: remove unused 'pg' parameter from 'Exdisc_t.typename'

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.binaryf'
Matthew Fernandez [Fri, 5 Aug 2022 04:16:27 +0000 (21:16 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.binaryf'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove unused parameters from 'Exdisc_t.binaryf'
Matthew Fernandez [Fri, 5 Aug 2022 04:15:09 +0000 (21:15 -0700)]
expr: remove unused parameters from 'Exdisc_t.binaryf'

I guess when I committed b0ec7b2eb448a2cb68ffb3751e9e054aecc60c24 it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.convertf'
Matthew Fernandez [Fri, 5 Aug 2022 04:10:26 +0000 (21:10 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.convertf'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove unused parameters from 'Exdisc_t.convertf'
Matthew Fernandez [Fri, 5 Aug 2022 04:07:55 +0000 (21:07 -0700)]
expr: remove unused parameters from 'Exdisc_t.convertf'

I guess when I committed 17479ab6569d40a4778870f712226aa7916f3ca3 it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove dereferencing and parens around calling 'Exdisc_t.reff'
Matthew Fernandez [Fri, 5 Aug 2022 03:56:27 +0000 (20:56 -0700)]
expr: remove dereferencing and parens around calling 'Exdisc_t.reff'

The compiler does not need to be explicitly told how to call through a function
pointer.

2 years agoexpr: remove further unused parameters from 'Exdisc_t.reff'
Matthew Fernandez [Fri, 5 Aug 2022 03:49:08 +0000 (20:49 -0700)]
expr: remove further unused parameters from 'Exdisc_t.reff'

I guess when I committed ef3ed2a98a46d0641d936c62fde78e719cef98f8 it was not
obvious to me that this is entirely part of private internal interfaces and the
callback signature involved is not exposed publicly.

2 years agoexpr: remove now unused 'disc' parameter from 'Exdisc_t.reff'
Matthew Fernandez [Fri, 5 Aug 2022 03:46:42 +0000 (20:46 -0700)]
expr: remove now unused 'disc' parameter from 'Exdisc_t.reff'

2 years agoexpr: replace 'exdump' SFIO buffer with an 'agxbuf'
Matthew Fernandez [Fri, 5 Aug 2022 03:36:32 +0000 (20:36 -0700)]
expr: replace 'exdump' SFIO buffer with an 'agxbuf'

Unfortunately there is no easy way to stage this. We need to do it all at once,
updating every use of `deparse` and all `exdump`’s internals.

This change improves locality – it is more obvious to both users and the
compiler that the contents of this temporary buffer does not need to be retained
beyond calls to `exerror`. This is a small step towards deprecating SFIO.

Gitlab: #1873

2 years agoexpr: inline private state into 'Excc_t'
Matthew Fernandez [Fri, 5 Aug 2022 02:13:43 +0000 (19:13 -0700)]
expr: inline private state into 'Excc_t'

Now that `Excc_t` is encapsulated in excc.c and no longer considered an
extensible struct, we can stop playing macro tricks to give it extra fields and
just express these more naturally.

2 years agoexpr: move 'Excc_t', 'Exccdisc_t' into excc.c
Matthew Fernandez [Fri, 5 Aug 2022 02:09:43 +0000 (19:09 -0700)]
expr: move 'Excc_t', 'Exccdisc_t' into excc.c

Following the previous commit, these are no longer referenced anywhere else.

2 years agoexpr: make 'exccopen', 'exccclose' static
Matthew Fernandez [Fri, 5 Aug 2022 01:59:13 +0000 (18:59 -0700)]
expr: make 'exccopen', 'exccclose' static

These are not used outside of their containing file, and making them private
will enable some more impactful clean up.

2 years agoexpr gen: remove dereferencing and parens on function pointer
Matthew Fernandez [Fri, 5 Aug 2022 01:48:41 +0000 (18:48 -0700)]
expr gen: remove dereferencing and parens on function pointer

The compiler knows how to call through a function pointer without needing to be
explicitly told.

2 years agoexpr exccopen: only pass SFIO stream to callback
Matthew Fernandez [Fri, 5 Aug 2022 01:41:06 +0000 (18:41 -0700)]
expr exccopen: only pass SFIO stream to callback

This function invokes `dtwalk` passing the callback `global` to be called with
a state parameter it supplies. It was supplying `cc`, but the callback only uses
a single member of this struct. So we can simplify this code by just passing the
stream the callback writes to, `cc->ccdisc-text`, or equivalently `disc->text`.

2 years agoMerge branch 'smattr/173D0FC2-B18B-4FFB-B2E6-6272F7273A5C' into 'main'
Matthew Fernandez [Sat, 6 Aug 2022 05:45:15 +0000 (05:45 +0000)]
Merge branch 'smattr/173D0FC2-B18B-4FFB-B2E6-6272F7273A5C' into 'main'

fix unchecked allocation failures, remove 'N_NEW' definitions

See merge request graphviz/graphviz!2777

2 years agoccomps: remove 'N_NEW' that was only used in one place
Matthew Fernandez [Sun, 31 Jul 2022 16:30:26 +0000 (09:30 -0700)]
ccomps: remove 'N_NEW' that was only used in one place

This brings us one step closer to having a single `N_NEW` macro in the tree and
not having to constantly wonder which of the `N_NEW` definitions is in scope at
any point where you see it called.

2 years agoPango plugin: remove unused 'NEW'
Matthew Fernandez [Sun, 31 Jul 2022 16:28:47 +0000 (09:28 -0700)]
Pango plugin: remove unused 'NEW'

2 years agoPango plugin gv_get_ps_fontlist: postpone 'family_name' allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:26:41 +0000 (09:26 -0700)]
Pango plugin gv_get_ps_fontlist: postpone 'family_name' allocation

Rather than allocating this upfront and then potentially needing to free it
later, we can use a string view to postpone the allocation to when we know it is
actually needed. This works because the lifetime of the backing memory extends
until the call to `g_free(families)`. This also fixes the lack of allocation
failure checks; instead of `strdup` we now call `strview_str` that gracefully
exits on allocation failure.

2 years agoPango plugin get_font_mapping: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:17:49 +0000 (09:17 -0700)]
Pango plugin get_font_mapping: fix unchecked allocation

2 years agoPango plugin gv_get_ps_fontlist: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:17:16 +0000 (09:17 -0700)]
Pango plugin gv_get_ps_fontlist: fix unchecked allocation

2 years agocommon genEllipticPath: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:16:12 +0000 (09:16 -0700)]
common genEllipticPath: fix unchecked allocation

2 years agocommon moveTo: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:15:42 +0000 (09:15 -0700)]
common moveTo: fix unchecked allocation

2 years agogml2gv nameOf: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:14:14 +0000 (09:14 -0700)]
gml2gv nameOf: fix unchecked allocation

2 years agogvgen makeTreeGen: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:07:38 +0000 (09:07 -0700)]
gvgen makeTreeGen: fix unchecked allocation

2 years agogvgen getCnt: fix unchecked allocation
Matthew Fernandez [Sun, 31 Jul 2022 16:06:12 +0000 (09:06 -0700)]
gvgen getCnt: fix unchecked allocation

2 years agogvgen mkTree: fix unchecked allocations
Matthew Fernandez [Sun, 31 Jul 2022 16:05:37 +0000 (09:05 -0700)]
gvgen mkTree: fix unchecked allocations

2 years agogvgen makeTetrix: fix unchecked allocations
Matthew Fernandez [Sun, 31 Jul 2022 16:05:06 +0000 (09:05 -0700)]
gvgen makeTetrix: fix unchecked allocations

2 years agogvgen makeSierpinski: fix unchecked allocations
Matthew Fernandez [Sun, 31 Jul 2022 16:04:11 +0000 (09:04 -0700)]
gvgen makeSierpinski: fix unchecked allocations

2 years agoMerge branch 'smattr/dcb7bc23-5914-43ae-94d5-0003feef06b0' into 'main'
Matthew Fernandez [Sat, 6 Aug 2022 00:58:56 +0000 (00:58 +0000)]
Merge branch 'smattr/dcb7bc23-5914-43ae-94d5-0003feef06b0' into 'main'

gvpr: more compiler warning squashing

See merge request graphviz/graphviz!2778

2 years agogvpr endString: squash a -Wconversion waning
Matthew Fernandez [Wed, 3 Aug 2022 01:37:21 +0000 (18:37 -0700)]
gvpr endString: squash a -Wconversion waning

`c` is known to be '\\' here.

2 years agogvpr parseID: simplify loop
Matthew Fernandez [Wed, 3 Aug 2022 01:34:31 +0000 (18:34 -0700)]
gvpr parseID: simplify loop

2 years agogvpr readc: cast to squash -Wconversion warnings
Matthew Fernandez [Wed, 3 Aug 2022 01:30:41 +0000 (18:30 -0700)]
gvpr readc: cast to squash -Wconversion warnings

These variables are known to be '\n' here.

2 years agogvpr: represent binding count as a size_t
Matthew Fernandez [Wed, 3 Aug 2022 01:29:15 +0000 (18:29 -0700)]
gvpr: represent binding count as a size_t

Squashes 3 -Wsign-conversion warnings.

2 years agogvpr tvtypeToStr: take a long long instead of int
Matthew Fernandez [Wed, 3 Aug 2022 01:16:18 +0000 (18:16 -0700)]
gvpr tvtypeToStr:  take a long long instead of int

This function is always called with long long values, so lets match it with its
callers. Squashes 2 -Wconversion warnings.

2 years agogvpr binary: remove unnecessary parens
Matthew Fernandez [Wed, 3 Aug 2022 01:06:11 +0000 (18:06 -0700)]
gvpr binary: remove unnecessary parens

2 years agogvpr binary: use local types that corresponds to the values being stored
Matthew Fernandez [Wed, 3 Aug 2022 01:04:11 +0000 (18:04 -0700)]
gvpr binary: use local types that corresponds to the values being stored

Squashes 2 -Wconversion warnings.

2 years agogvpr validTVT: remove unnecessary parens
Matthew Fernandez [Wed, 3 Aug 2022 01:06:50 +0000 (18:06 -0700)]
gvpr validTVT: remove unnecessary parens

2 years agogvpr validTVT: return a more appropriate type
Matthew Fernandez [Wed, 3 Aug 2022 01:01:57 +0000 (18:01 -0700)]
gvpr validTVT: return a more appropriate type