]> granicus.if.org Git - graphviz/log
graphviz
2 years agoCI: remove legacy TODO in deploy script
Matthew Fernandez [Fri, 8 Jul 2022 02:28:11 +0000 (19:28 -0700)]
CI: remove legacy TODO in deploy script

This was addressed in 6117abe680037824d134149b0de42f589fb24466, with subsequent
fixes in 92804597802903f126c3d701179fc06bda58ed4c and
156b57941de82d1d229c0ccf331cf2dc3a9f7e32.

2 years agoMerge branch 'smattr/6a4630c7-4928-4c5c-a28f-4b9a0f7ad13d' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 19:21:30 +0000 (19:21 +0000)]
Merge branch 'smattr/6a4630c7-4928-4c5c-a28f-4b9a0f7ad13d' into 'main'

gv_trim_zeros: identify string extent instead of writing a '\0'

See merge request graphviz/graphviz!2749

2 years agogv_trim_zeros: identify string extent instead of writing a '\0'
Matthew Fernandez [Fri, 8 Jul 2022 03:19:38 +0000 (20:19 -0700)]
gv_trim_zeros: identify string extent instead of writing a '\0'

The buffer that this function was truncating is destined for `gvwrite`. So we
can make the whole thing read-only by identifying a string extent instead of
modifying the buffer in place. The compiler may have been able to identify the
intent of this code anyway¹ but if not these changes make it clearer how this
code can be optimized.

¹ Though probably not if the experience discussed in
  bf800b51ccf5808c9b4faecdec01488b5513c307 is anything to go by.

2 years agoMerge branch 'smattr/AC13F6AC-696F-43DA-AA5E-4B62E0EE03FB' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 18:17:24 +0000 (18:17 +0000)]
Merge branch 'smattr/AC13F6AC-696F-43DA-AA5E-4B62E0EE03FB' into 'main'

glcomp: remove no-op casts

See merge request graphviz/graphviz!2751

2 years agoglcomp: remove no-op casts
Matthew Fernandez [Sat, 9 Apr 2022 19:05:35 +0000 (12:05 -0700)]
glcomp: remove no-op casts

2 years agoMerge branch 'smattr/255050CF-C355-4788-9063-95138C4395EB' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 17:09:47 +0000 (17:09 +0000)]
Merge branch 'smattr/255050CF-C355-4788-9063-95138C4395EB' into 'main'

move dot_builtins.c into C++

See merge request graphviz/graphviz!2752

2 years agomove dot_builtins.c into C++
Matthew Fernandez [Sat, 28 May 2022 17:40:34 +0000 (10:40 -0700)]
move dot_builtins.c into C++

This looks like a bit of a strange change, when we now wrap the entire file in
`extern "C"`. However this has two key benefits:

  1. `dot_builtins` and `dot_static` that include this source needed an
     Autotools hack¹ to force compilation to use the C++ front end (`c++`)
     instead of the C front end (`cc`) in order to link against the C++ standard
     library. By moving this source into C++ we can remove this hack.

  2. When trying to integrate `dot_builtins` into the CMake build system, MSVC
     complains (correctly) that the initializers to the array in this file are
     not compile-time constants. GCC and Clang apparently allow this by a
     non-standard extension. By moving this into C++, we get more relaxed
     initialization semantics that allow this on all compilers.

Gitlab: #1836

¹ https://www.gnu.org/software/automake/manual/automake.html#Libtool-Convenience-Libraries

2 years agoMerge branch 'smattr/B5CBD467-EBB2-4F04-B9EA-75F2E2AC4093' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 15:59:50 +0000 (15:59 +0000)]
Merge branch 'smattr/B5CBD467-EBB2-4F04-B9EA-75F2E2AC4093' into 'main'

common: some macro clean up

See merge request graphviz/graphviz!2744

2 years agocommon: remove 'GD_inleaf'
Matthew Fernandez [Wed, 6 Jul 2022 04:11:43 +0000 (21:11 -0700)]
common: remove 'GD_inleaf'

As discussed in the prior commit, this refers to a field that does not and has
never existed.

2 years agodotgen: remove 'OBSOLETE'-guarded code
Matthew Fernandez [Wed, 6 Jul 2022 04:00:34 +0000 (21:00 -0700)]
dotgen: remove 'OBSOLETE'-guarded code

This code is not currently compiled and, in fact, will not compile if you try to
re-enable it. As an example issue, it uses `GD_inleaf`, a macro intended for
accessing `Agraphinfo_t` fields, on a `node_t`. This is sort of a double mistake
as `Agraphinfo_t` also has no `inleaf` field. This problem seems to have been
present in the very first Graphviz revision,
256ef66663ca0c072554ee3f5e7971911031b3c7. Fortunately the mistakes sort of
cancelled each other out because the `GD_*` marcos did no casting and
`Agnodeinfo_t` _does_ have an `inleaf` field. The outcome seems to be what the
author intended, even if the route by which they got there was not intended.

The above is only one of several issues with this code. Resurrecting it has
unknown cost and unknown benefit, so we remove it here to avoid the implication
that it can be easily switched back on.

2 years agocommon: remove 'GD_cl_cnt'
Matthew Fernandez [Wed, 6 Jul 2022 03:48:39 +0000 (20:48 -0700)]
common: remove 'GD_cl_cnt'

This macro is clearly typoed (it refers to the field `cl_nt` while its name says
`cl_cnt`), but this macro has also never been used.

2 years agoMerge branch 'smattr/gitlab-2256' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 06:14:00 +0000 (06:14 +0000)]
Merge branch 'smattr/gitlab-2256' into 'main'

xlib plugin: relax button value assertions

Closes #2256

See merge request graphviz/graphviz!2740

2 years agoxlib plugin: relax button value assertions
Matthew Fernandez [Mon, 4 Jul 2022 21:44:42 +0000 (14:44 -0700)]
xlib plugin: relax button value assertions

Contrary to the X11 documentation,¹ it seems button values other than 1-5 can be
returned as button press events. The assertions altered in this commit were
introduced to guarantee the value does not exceed the limits of the type of the
parameter in the user’s callback (`int`). So we can safely relax this to just
the limit itself.

Gitlab: fixes #2256

¹ https://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#Keyboard_and_Pointer_Events_b

2 years agoMerge branch 'clone-name-clash' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 04:26:34 +0000 (04:26 +0000)]
Merge branch 'clone-name-clash' into 'main'

rename clone to cloneO to avoid clone(2) nameclash

See merge request graphviz/graphviz!2750

2 years agorename clone to cloneO to avoid clone(2) nameclash
Natanael Copa [Tue, 26 Jul 2011 12:41:21 +0000 (12:41 +0000)]
rename clone to cloneO to avoid clone(2) nameclash

Rename clone to cloneO to avoid a name clash with the Linux `clone`
syscall. https://man7.org/linux/man-pages/man2/clone.2.html

2 years agoMerge branch 'chgraph-h' into 'main'
Matthew Fernandez [Sat, 9 Jul 2022 03:21:23 +0000 (03:21 +0000)]
Merge branch 'chgraph-h' into 'main'

doxygen doc for cgraph.h

See merge request graphviz/graphviz!2741

2 years agocgraph.h: exclude irrelevant from doxygen
Costa Shulyupin [Tue, 5 Jul 2022 13:16:53 +0000 (16:16 +0300)]
cgraph.h: exclude irrelevant from doxygen

2 years agocgraph.h: reformat comments for doxygen
Costa Shulyupin [Tue, 5 Jul 2022 13:15:57 +0000 (16:15 +0300)]
cgraph.h: reformat comments for doxygen

2 years agoDoxyfile: ignore attribute PRINTF_LIKE
Costa Shulyupin [Tue, 5 Jul 2022 12:34:24 +0000 (15:34 +0300)]
Doxyfile: ignore attribute PRINTF_LIKE

because it is not relevant for documentation

2 years agoMerge branch 'logic' into 'main'
Matthew Fernandez [Fri, 8 Jul 2022 03:15:21 +0000 (03:15 +0000)]
Merge branch 'logic' into 'main'

replace obsolete logic.h

See merge request graphviz/graphviz!2745

2 years agoremove obsolete unused logic.h
Costa Shulyupin [Wed, 6 Jul 2022 09:38:31 +0000 (12:38 +0300)]
remove obsolete unused logic.h

to reduce number of files in overpopulated directory lib/common
and make project a little bit more tidy

2 years agoreplace include of logic.h with stdbool.h
Costa Shulyupin [Wed, 6 Jul 2022 09:35:18 +0000 (12:35 +0300)]
replace include of logic.h with stdbool.h

and replace FALSE/TRUE with false/true

to reuse standard definitions

2 years agoremove unused includes of logic.h
Costa Shulyupin [Wed, 6 Jul 2022 09:32:46 +0000 (12:32 +0300)]
remove unused includes of logic.h

to keep the code a bit cleaner

2 years agoMerge branch 'smattr/A2FCED53-DEC0-47DE-BC19-01625CA7B4E9' into 'main'
Matthew Fernandez [Fri, 8 Jul 2022 01:00:59 +0000 (01:00 +0000)]
Merge branch 'smattr/A2FCED53-DEC0-47DE-BC19-01625CA7B4E9' into 'main'

Start 5.0.1 development

See merge request graphviz/graphviz!2747

2 years agoStart 5.0.1 development
Matthew Fernandez [Fri, 8 Jul 2022 00:24:05 +0000 (17:24 -0700)]
Start 5.0.1 development

2 years agoMerge branch 'smattr/02831009-9CCD-442E-B5A1-42688269FF91' into 'main' 5.0.0
Matthew Fernandez [Thu, 7 Jul 2022 15:40:57 +0000 (15:40 +0000)]
Merge branch 'smattr/02831009-9CCD-442E-B5A1-42688269FF91' into 'main'

Stable Release 5.0.0

See merge request graphviz/graphviz!2738

2 years agoStable Release 5.0.0
Matthew Fernandez [Sun, 3 Jul 2022 04:49:22 +0000 (21:49 -0700)]
Stable Release 5.0.0

2 years agofix CHANGELOG link
Matthew Fernandez [Sun, 3 Jul 2022 04:48:43 +0000 (21:48 -0700)]
fix CHANGELOG link

2 years agofix markdown indentation
Matthew Fernandez [Sun, 3 Jul 2022 04:45:38 +0000 (21:45 -0700)]
fix markdown indentation

2 years agoMerge branch 'smattr/C9FBABF6-463E-4B3D-9EA4-2EE6F963B313' into 'main'
Matthew Fernandez [Tue, 5 Jul 2022 16:11:15 +0000 (16:11 +0000)]
Merge branch 'smattr/C9FBABF6-463E-4B3D-9EA4-2EE6F963B313' into 'main'

gvpr: rewrite 'indexOf' to a simpler equivalent

See merge request graphviz/graphviz!2732

2 years agogvpr: rewrite 'indexOf' to a simpler equivalent
Matthew Fernandez [Fri, 1 Jul 2022 15:13:56 +0000 (08:13 -0700)]
gvpr: rewrite 'indexOf' to a simpler equivalent

This was initially attempted in 84efe93d5c5a4da0e778dbf01ed8550d2d774fdf and
then reverted in 51d787ece01fb4443db5eabd6932046b7b715dbc when it was discovered
this introduced a bug. The present commit fixes the, now obvious in retrospect,
bug with the original change of flipping the operands in the final subtraction.

This was validated by doing an exhaustive comparison of all strlen ≤2 inputs to
both the before and after function. Not bulletproof, but it is a strong signal
that the new version is functionally identical.

2 years agoMerge branch 'smattr/FDF1EA53-08F9-4F8C-8A22-2430083D6152' into 'main'
Matthew Fernandez [Tue, 5 Jul 2022 04:44:54 +0000 (04:44 +0000)]
Merge branch 'smattr/FDF1EA53-08F9-4F8C-8A22-2430083D6152' into 'main'

some allocation call clean up

See merge request graphviz/graphviz!2734

2 years agogxl2gv: fix an unchecked allocation failure
Matthew Fernandez [Sat, 2 Jul 2022 02:46:21 +0000 (19:46 -0700)]
gxl2gv: fix an unchecked allocation failure

2 years agographml2gv: fix an unchecked allocation failure
Matthew Fernandez [Sat, 2 Jul 2022 02:45:20 +0000 (19:45 -0700)]
graphml2gv: fix an unchecked allocation failure

2 years agodiffimg: replace 'xmalloc' with central allow wrapper
Matthew Fernandez [Sat, 2 Jul 2022 02:43:29 +0000 (19:43 -0700)]
diffimg: replace 'xmalloc' with central allow wrapper

2 years agopango plugin: replace 'xstrdup' with central alloc wrapper
Matthew Fernandez [Sat, 2 Jul 2022 02:41:53 +0000 (19:41 -0700)]
pango plugin: replace 'xstrdup' with central alloc wrapper

2 years agoMerge branch 'smattr/AA938AAA-1935-4594-A534-5EC62FFFBF57' into 'main'
Matthew Fernandez [Tue, 5 Jul 2022 02:56:17 +0000 (02:56 +0000)]
Merge branch 'smattr/AA938AAA-1935-4594-A534-5EC62FFFBF57' into 'main'

reference counted strings: de-duplicate some code, introduce malloc failure checks

See merge request graphviz/graphviz!2735

2 years agoagstrdup_internal: handle allocation failures
Matthew Fernandez [Sat, 2 Jul 2022 02:06:58 +0000 (19:06 -0700)]
agstrdup_internal: handle allocation failures

2 years agooutline the common core of 'agstrdup' and 'agstrdup_html'
Matthew Fernandez [Sat, 2 Jul 2022 02:04:01 +0000 (19:04 -0700)]
outline the common core of 'agstrdup' and 'agstrdup_html'

2 years agoMerge branch 'smattr/25FB51E1-C422-452D-9D1F-130886D5BAC3' into 'main'
Matthew Fernandez [Tue, 5 Jul 2022 01:53:26 +0000 (01:53 +0000)]
Merge branch 'smattr/25FB51E1-C422-452D-9D1F-130886D5BAC3' into 'main'

core plugin: fix unchecked allocation failure in dot rendering

See merge request graphviz/graphviz!2736

2 years agocore plugin: fix unchecked allocation failure in dot rendering
Matthew Fernandez [Sat, 2 Jul 2022 15:45:18 +0000 (08:45 -0700)]
core plugin: fix unchecked allocation failure in dot rendering

2 years agoMerge branch 'smattr/c7e76059-49ef-436d-940e-f756525e7a55' into 'main'
Matthew Fernandez [Mon, 4 Jul 2022 23:19:30 +0000 (23:19 +0000)]
Merge branch 'smattr/c7e76059-49ef-436d-940e-f756525e7a55' into 'main'

gvpr simplification

See merge request graphviz/graphviz!2737

2 years agogvpr: squash -Wunused-parameter warnings in 'gvexitf'
Matthew Fernandez [Sat, 2 Jul 2022 20:50:47 +0000 (13:50 -0700)]
gvpr: squash -Wunused-parameter warnings in 'gvexitf'

This function needs to conform to the `exitf` type signature, so these
parameters cannot be removed.

2 years agogvpr: make use of 'okay' clearer in 'evalNode'
Matthew Fernandez [Sat, 2 Jul 2022 20:48:26 +0000 (13:48 -0700)]
gvpr: make use of 'okay' clearer in 'evalNode'

Squashes a -Wconversion warning.

2 years agogvpr: make use of 'okay' clearer in 'evalEdge'
Matthew Fernandez [Sat, 2 Jul 2022 20:47:40 +0000 (13:47 -0700)]
gvpr: make use of 'okay' clearer in 'evalEdge'

Squashes a -Wconversion warning.

2 years agogvpr: exit on allocation failure in 'concat'
Matthew Fernandez [Sat, 2 Jul 2022 15:37:37 +0000 (08:37 -0700)]
gvpr: exit on allocation failure in 'concat'

This function gracefully handled allocation failures by returning 0. Except its
caller does not check for this and assumes the returned pointer is non-null.

2 years agogvpr: fix unchecked allocation failures in 'resolve'
Matthew Fernandez [Sat, 2 Jul 2022 15:36:00 +0000 (08:36 -0700)]
gvpr: fix unchecked allocation failures in 'resolve'

2 years agogvpr: fix unchecked allocation failure in 'parseArgs'
Matthew Fernandez [Sat, 2 Jul 2022 15:35:46 +0000 (08:35 -0700)]
gvpr: fix unchecked allocation failure in 'parseArgs'

2 years agogvpr: simplify 'freeOpts' by passing by value
Matthew Fernandez [Sat, 2 Jul 2022 15:30:52 +0000 (08:30 -0700)]
gvpr: simplify 'freeOpts' by passing by value

This also removes the conditional on `argc` in this function. The contained loop
is a no-op when `argc` is 0 and in this case `argv` is NULL, which it is well
defined to `free`.

2 years agogvpr: stack-allocate options struct
Matthew Fernandez [Sat, 2 Jul 2022 15:28:09 +0000 (08:28 -0700)]
gvpr: stack-allocate options struct

There is no need to heap-allocate this struct that is small and whose usage is
well scoped.

2 years agoMerge branch 'cgraph' into 'main'
Matthew Fernandez [Mon, 4 Jul 2022 22:18:19 +0000 (22:18 +0000)]
Merge branch 'cgraph' into 'main'

cgraph doxygen title comments

See merge request graphviz/graphviz!2739

2 years agocgraph doxygen title comments
Costa Shulyupin [Mon, 4 Jul 2022 22:18:19 +0000 (22:18 +0000)]
cgraph doxygen title comments

2 years agoMerge branch 'smattr/gitlab-358' into 'main'
Matthew Fernandez [Mon, 4 Jul 2022 21:23:10 +0000 (21:23 +0000)]
Merge branch 'smattr/gitlab-358' into 'main'

fix: Revert "rewrite versionStr2Version to use strtoul"

Closes #358

See merge request graphviz/graphviz!2733

2 years agofix: Revert "rewrite versionStr2Version to use strtoul"
Matthew Fernandez [Sat, 2 Jul 2022 03:23:27 +0000 (20:23 -0700)]
fix: Revert "rewrite versionStr2Version to use strtoul"

This reverts commit 5aa56175c4715700cc8bf9fecad7b27665c04379. This commit
inadvertently changed the parsing of the `xdotversion` attribute to make
something like “1.7” parse as version 1.

Gitlab: fixes #358

2 years agoadd a test case for #358
Matthew Fernandez [Sat, 2 Jul 2022 03:17:18 +0000 (20:17 -0700)]
add a test case for #358

2 years agoMerge branch 'smattr/gitlab-1801' into 'main'
Matthew Fernandez [Sun, 3 Jul 2022 05:49:31 +0000 (05:49 +0000)]
Merge branch 'smattr/gitlab-1801' into 'main'

Proutespline: remove exception-style control flow

See merge request graphviz/graphviz!2731

2 years agogrowops: squash a -Wsign-conversion warning
Matthew Fernandez [Tue, 28 Jun 2022 01:44:18 +0000 (18:44 -0700)]
growops: squash a -Wsign-conversion warning

By construction, `newopn` can only ever be non-negative here. Though in the long
term a more sweeping change should be done to count items in `size_t` variables
pervasively.

2 years agoreallyroutespline: squash a -Wsign-conversion warning
Matthew Fernandez [Tue, 28 Jun 2022 01:42:29 +0000 (18:42 -0700)]
reallyroutespline: squash a -Wsign-conversion warning

By construction, `inpn` can only ever be non-negative here. Though in the long
term a more sweeping change should be done to count items in `size_t` variables
pervasively.

2 years agoProutespline: remove exception-style control flow
Matthew Fernandez [Tue, 28 Jun 2022 01:40:07 +0000 (18:40 -0700)]
Proutespline: remove exception-style control flow

Memory allocation failures now result in a conventional return, propagated up
through the call stack.

Github: #1801

2 years agoreallyroutespline: fix unchecked failures on recursion
Matthew Fernandez [Tue, 28 Jun 2022 01:20:24 +0000 (18:20 -0700)]
reallyroutespline: fix unchecked failures on recursion

2 years agoMerge branch 'smattr/5c305fc5-c55f-4cb9-a061-007ed0d2be2a' into 'main'
Matthew Fernandez [Sat, 2 Jul 2022 02:18:56 +0000 (02:18 +0000)]
Merge branch 'smattr/5c305fc5-c55f-4cb9-a061-007ed0d2be2a' into 'main'

use a string view abstraction to simplify plugin parsing code

See merge request graphviz/graphviz!2729

2 years agogvplugin_graph: fix unchecked allocation failures
Matthew Fernandez [Sun, 26 Jun 2022 20:28:20 +0000 (13:28 -0700)]
gvplugin_graph: fix unchecked allocation failures

The substring construction in `gvplugin_graph` unfortunately cannot be easily
converted to `strview_t` because it passes pointers to `agxset` which expects a
`'\0'` terminated string. We can at least fix previously unnoticed allocation
failures though.

2 years agogvPluginList: fix: manage 'q' as a 'strview_t'
Matthew Fernandez [Sun, 26 Jun 2022 20:22:57 +0000 (13:22 -0700)]
gvPluginList: fix: manage 'q' as a 'strview_t'

This fixes a memory leak that would occur when duplicate items were encountered.
The conditional block in this loop would not be entered and the memory that `q`
pointed to would be lost in the next iteration of the loop when `q` was set to a
new string.

2 years agogvPluginList: fix unchecked allocation failure
Matthew Fernandez [Sun, 26 Jun 2022 20:18:46 +0000 (13:18 -0700)]
gvPluginList: fix unchecked allocation failure

When `strdup` failed to allocate memory, this would go unnoticed, leading to a
crash.

2 years agogvPluginList: use a 'strview_t' for 'typestr_last'
Matthew Fernandez [Sun, 26 Jun 2022 20:16:34 +0000 (13:16 -0700)]
gvPluginList: use a 'strview_t' for 'typestr_last'

This has no immediate effect, but will simply the next commit.

2 years agogvPluginList: squash -Wunused-parameter warning
Matthew Fernandez [Sun, 26 Jun 2022 20:09:17 +0000 (13:09 -0700)]
gvPluginList: squash -Wunused-parameter warning

As described in the leading comment, this is intentionally unused for now.

2 years agogvplugin_list: use a 'strview_t' for 'type' in second loop
Matthew Fernandez [Sun, 26 Jun 2022 20:08:05 +0000 (13:08 -0700)]
gvplugin_list: use a 'strview_t' for 'type' in second loop

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_list: use a 'strview_t' for 'type_last'
Matthew Fernandez [Sun, 26 Jun 2022 20:03:21 +0000 (13:03 -0700)]
gvplugin_list: use a 'strview_t' for 'type_last'

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_list: use a 'strview_t' for handling prefix of 'str'
Matthew Fernandez [Sun, 26 Jun 2022 19:58:01 +0000 (12:58 -0700)]
gvplugin_list: use a 'strview_t' for handling prefix of 'str'

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_list: use a 'strview_t' for 'type' in first loop
Matthew Fernandez [Sun, 26 Jun 2022 19:47:04 +0000 (12:47 -0700)]
gvplugin_list: use a 'strview_t' for 'type' in first loop

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_load: use a 'strview_t' for 'reqtyp'
Matthew Fernandez [Sun, 26 Jun 2022 19:41:02 +0000 (12:41 -0700)]
gvplugin_load: use a 'strview_t' for 'reqtyp'

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_load: use a 'strview_t' for 'typ'
Matthew Fernandez [Sun, 26 Jun 2022 19:02:15 +0000 (12:02 -0700)]
gvplugin_load: use a 'strview_t' for 'typ'

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_load: use a 'strview_t' for 'reqdep'
Matthew Fernandez [Sun, 26 Jun 2022 18:58:06 +0000 (11:58 -0700)]
gvplugin_load: use a 'strview_t' for 'reqdep'

Slightly more readable and less error prone than doing this inline.

2 years agogvplugin_load: use a 'strview_t' for 'dep'
Matthew Fernandez [Sun, 26 Jun 2022 19:19:25 +0000 (12:19 -0700)]
gvplugin_load: use a 'strview_t' for 'dep'

Similar to the previous commit, this string is either `NULL` or terminated by a
`'\0'`, so there is little advantage in using a `strview_t` over a
`const char*`. But this will make it more consistent with surrounding code after
upcoming changes.

2 years agogvplugin_load: use a 'strview_t' for 'reqpkg'
Matthew Fernandez [Sun, 26 Jun 2022 19:10:34 +0000 (12:10 -0700)]
gvplugin_load: use a 'strview_t' for 'reqpkg'

This string is always terminated by `'\0'`, not `':'`, so there is little
advantage in using a `strview_t` over a `const char*`. But upcoming changes will
refactor the surrounding code to use `strview_t`, so it will be more readable to
use `strview_t` consistently here.

2 years agogvplugin_install: use 'strview_t' to simplify second type string comparison loop
Matthew Fernandez [Sun, 26 Jun 2022 18:46:16 +0000 (11:46 -0700)]
gvplugin_install: use 'strview_t' to simplify second type string comparison loop

2 years agogvplugin_install: use 'strview_t' to simplify type string comparison loop
Matthew Fernandez [Sun, 26 Jun 2022 18:40:13 +0000 (11:40 -0700)]
gvplugin_install: use 'strview_t' to simplify type string comparison loop

2 years agogvplugin_install: refactor 'typestr' end locating logic to use a 'strview_t'
Matthew Fernandez [Sun, 26 Jun 2022 18:24:17 +0000 (11:24 -0700)]
gvplugin_install: refactor 'typestr' end locating logic to use a 'strview_t'

Slightly more readable and less error prone than doing this inline.

2 years agoadd an abstraction for string references
Matthew Fernandez [Sun, 26 Jun 2022 18:01:38 +0000 (11:01 -0700)]
add an abstraction for string references

2 years agoMerge branch 'smattr/4C27B32D-9DA4-4AE8-846A-42EC6F6422C4' into 'main'
Matthew Fernandez [Sat, 2 Jul 2022 00:12:24 +0000 (00:12 +0000)]
Merge branch 'smattr/4C27B32D-9DA4-4AE8-846A-42EC6F6422C4' into 'main'

compiler warning squashing

See merge request graphviz/graphviz!2730

2 years agorecordlintrsx: remove unused 'xlp' parameter
Matthew Fernandez [Sun, 26 Jun 2022 22:54:39 +0000 (15:54 -0700)]
recordlintrsx: remove unused 'xlp' parameter

2 years agorecordointrsx: remove unused 'xlp' parameter
Matthew Fernandez [Sun, 26 Jun 2022 22:53:00 +0000 (15:53 -0700)]
recordointrsx: remove unused 'xlp' parameter

2 years agostress_majorization_with_hierarchy: remove unused 'nedges_graph' parameter
Matthew Fernandez [Sun, 26 Jun 2022 22:48:38 +0000 (15:48 -0700)]
stress_majorization_with_hierarchy: remove unused 'nedges_graph' parameter

2 years agostress_majorization_kD_mkernel: remove unused 'nedges_graph' parameter
Matthew Fernandez [Sun, 26 Jun 2022 22:43:35 +0000 (15:43 -0700)]
stress_majorization_kD_mkernel: remove unused 'nedges_graph' parameter

2 years agosparse_stress_subspace_majorization_kD: remove unused 'nedges_graph' parameter
Matthew Fernandez [Sun, 26 Jun 2022 22:39:04 +0000 (15:39 -0700)]
sparse_stress_subspace_majorization_kD: remove unused 'nedges_graph' parameter

2 years agoprototype 'makeTetrix', squashing a '-Wmissing-prototypes' warning
Matthew Fernandez [Sat, 25 Jun 2022 05:05:31 +0000 (22:05 -0700)]
prototype 'makeTetrix', squashing a '-Wmissing-prototypes' warning

The missing prototype appears to have two causes:

  1. 265eeb66ea0dbb4f7cdeb75dcc5f802d948b40a9 added `makeTetrix` without a
     prototype.

  2. b4947d67a4ebd48ca0105d44f92e47f044e51600 appears to have applied some
     Coverity suggestions without investigating the underlying history that led
     to the Coverity warnings.

2 years agoMerge branch 'smattr/gitlab-121' into 'main'
Matthew Fernandez [Sun, 26 Jun 2022 22:32:00 +0000 (22:32 +0000)]
Merge branch 'smattr/gitlab-121' into 'main'

fix 'merge_chain' assertion failure

Closes #121

See merge request graphviz/graphviz!2724

2 years agofix 'merge_chain' assertion failure
Matthew Fernandez [Tue, 21 Jun 2022 03:09:05 +0000 (20:09 -0700)]
fix 'merge_chain' assertion failure

When calling `merge_chain` from `interclexp`, this code apparently did not
anticipate that both the condition `ND_rank(agtail(e)) == ND_rank(aghead(e))`
and `ED_to_virt(prev) != NULL` could be true at once. In this case, the merge
can happen but the `.to_virt` member of `e` needs to be overwritten; it is not
`NULL` on entry to `merge_chain`.

This issue appears to have existed since the first revision of Graphviz.

These is a lot of uncertainty around what the expected behavior of this code is
and whether this fix is correct. So here is some of my background thoughts:¹

  `merge_chain` has a leading `assert(ED_to_virt(e) == NULL)`, presumably trying
  to express the assumption that it is not overwriting an existing back pointer.
  But the code here in `interclexp` seems to be deliberately trying to overwrite
  this pointer. There seemed to me two possible local fixes:

    1. Remove the assertion
    2. Write `NULL` to `ED_to_virt(e)` in advance

  The first possibility seemed more risky. This would allow other functions to
  accidentally call into merge_chain with a non-null `ED_to_virt(e)` and for
  this to go undetected.

  On the other hand, it's possible my change here is mistaken and what the
  original author intended was for the true case of the branch on line 181 to
  continue after updating `ED_to_virt(e) = prev`, making the call to
  `merge_chain` not reached in this scenario. It certainly looks pretty weird
  for the code after my changes to set `ED_to_virt(e)` on lines 181-184 and then
  subsequently overwrite this value on line 187. But I was guessing the initial
  write is relevant for the case where we continue.

  As you can tell, all of this is (barely) educated guess work. I find the
  intent of this code very hard to determine.

Gitlab: fixes #121

¹ Quoted from discussion on
  https://gitlab.com/graphviz/graphviz/-/merge_requests/2724#note_1005393861.

2 years agoadd a test case for #121
Matthew Fernandez [Tue, 21 Jun 2022 02:49:12 +0000 (19:49 -0700)]
add a test case for #121

2 years agoMerge branch 'smattr/6888df1f-aa29-4ebf-8fd1-824cdf74cbee' into 'main'
Matthew Fernandez [Sun, 26 Jun 2022 19:01:07 +0000 (19:01 +0000)]
Merge branch 'smattr/6888df1f-aa29-4ebf-8fd1-824cdf74cbee' into 'main'

fix: select DEB CPack back end on Debian

See merge request graphviz/graphviz!2728

2 years agofix: select DEB CPack back end on Debian
Matthew Fernandez [Sat, 25 Jun 2022 20:54:18 +0000 (13:54 -0700)]
fix: select DEB CPack back end on Debian

Debian’s /etc/os-release does not include the field `ID_LIKE`, which is perhaps
reasonable as it is a base distribution not derived from another. A side effect
of this was that CPack picked the RPM back end when generating a Graphviz
package. This change teaches it that Debian should also get the DEB back end.

2 years agoMerge branch 'smattr/14413CBC-E9B9-4119-B46C-D234278D8A87' into 'main'
Matthew Fernandez [Sun, 26 Jun 2022 00:12:04 +0000 (00:12 +0000)]
Merge branch 'smattr/14413CBC-E9B9-4119-B46C-D234278D8A87' into 'main'

gvplugin_list: remove dynamic allocations

See merge request graphviz/graphviz!2727

2 years agogvplugin_list: remove a second unnecessary duplication of 'typestr'
Matthew Fernandez [Sat, 25 Jun 2022 02:55:12 +0000 (19:55 -0700)]
gvplugin_list: remove a second unnecessary duplication of 'typestr'

By managing an extent into the original string, we can avoid a dynamic
allocation in this code. This is similar in spirit to
5a13ab3f08b2066a795ea152f9594f6719d3aaa6.

2 years agogvplugin_list: remove unnecessary duplication of 'typestr'
Matthew Fernandez [Sat, 25 Jun 2022 02:32:42 +0000 (19:32 -0700)]
gvplugin_list: remove unnecessary duplication of 'typestr'

By managing an extent into the original string, we can avoid a dynamic
allocation in this code. This is similar in spirit to
5a13ab3f08b2066a795ea152f9594f6719d3aaa6.

The code here actually looks wrong. It tries to pull out colon-separated
entries, but then uses the full string (`pnext->typestr`) in the call to
`agxbprint`. But this commit leaves this as-is for now.

2 years agogvplugin_list: remove unnecessary duplication of 'str'
Matthew Fernandez [Fri, 24 Jun 2022 14:20:09 +0000 (07:20 -0700)]
gvplugin_list: remove unnecessary duplication of 'str'

By managing an extent into the original string, we can avoid a dynamic
allocation in this code. This is similar in spirit to
5a13ab3f08b2066a795ea152f9594f6719d3aaa6.

2 years agogvplugin_package_record: replace unchecked 'strdup' with alloc wrapper
Matthew Fernandez [Fri, 24 Jun 2022 14:13:41 +0000 (07:13 -0700)]
gvplugin_package_record: replace unchecked 'strdup' with alloc wrapper

This turns what was previously a crash on out-of-memory into a graceful exit.

2 years agopango_free_layout: remove unnecessary cast
Matthew Fernandez [Fri, 24 Jun 2022 13:52:59 +0000 (06:52 -0700)]
pango_free_layout: remove unnecessary cast

2 years agoMerge branch 'smattr/gitlab-2093' into 'main'
Matthew Fernandez [Sat, 25 Jun 2022 22:30:54 +0000 (22:30 +0000)]
Merge branch 'smattr/gitlab-2093' into 'main'

gxl2gv: fix: anticipate elements with missing ID

Closes #2093

See merge request graphviz/graphviz!2726

2 years agogxl2gv: fix: anticipate elements with missing ID
Matthew Fernandez [Thu, 23 Jun 2022 04:52:47 +0000 (21:52 -0700)]
gxl2gv: fix: anticipate elements with missing ID

This fixes a previous out-of-bounds pointer dereference that occurred in
`startElementHandler`.

Gitlab: fixes #2093

2 years agoadd a test case for #2093
Matthew Fernandez [Thu, 23 Jun 2022 04:38:08 +0000 (21:38 -0700)]
add a test case for #2093