Emden Gansner [Fri, 16 Dec 2016 22:15:01 +0000 (17:15 -0500)]
Fix a couple of lose ends where incorrect information is given in
error messages. Make sure each call to agmemread resets the line number
to 1 and the file name to NULL. If the input contains cpp line directive,
another run of agmemread with errors would report them incorrectly.
In addition, the gvNextInputGraph in common/input.s was not resetting the
the file name in the case that the new FILE* happened to use the same memory
as the previous FILE*.
Emden Gansner [Fri, 16 Dec 2016 20:02:23 +0000 (15:02 -0500)]
At present, if the graph has no nodes, no layout is done. But then if gvFreeLayout is called
and there are subgraphs, dot_cleanup_graph assumes the subgraphs are bound to a Agraphinfo_t,
which doesn't exist. The calls to free the associated memory cause a crash.
The simplest solution is to check that Agraphinfo_t exists in dot_cleanup_graph before using it.
Erwin Janssen [Mon, 12 Dec 2016 14:50:50 +0000 (15:50 +0100)]
Remove unused FPE initialization from dot.c
In cmd/dot/dot.c, non standard floating point exceptions are enabled
in a platform specific way in a sequence of `ifdef`s. However, this
is never used because:
- The rest of the code never checks for set floating point exception
flags (with `fetestexcept` for example).
- The check that toggles the whole block, `ifndef NO_FPERR` is almost
false. `NO_FPERR` is always defined on Windows and only disabled on
specific platforms that do not support `-ffast-math`.
In conclusion, the code adds unnecessary complexity and can be removed.
Emden Gansner [Fri, 9 Dec 2016 20:28:41 +0000 (15:28 -0500)]
Fix verbose printing. First, we are not printing the graph depth, but the
maximum number of steps to the center. Second, we can't use SLEAF if the root
is specified, since SLEAF is not calculated in that case.
Erwin Janssen [Wed, 7 Dec 2016 13:56:39 +0000 (14:56 +0100)]
Fixed 3 potential memory leaks in QuadTree.c
In the function `QuadTree_new_from_point_list` in lib/sparse/QuadTree.c,
memory is allocated for tree variables. The check that follows returns
NULL if one of the pointers is NULL (indicating memory allocation
failure). However, it is possible that memory allocation succeeds for one
or two variables, but fails for the third. If this happens, the functions
returns NULL, but the allocated memory isn't freed.
The fix is to free all three pointers in case of a failure. If memory is
allocated it is freed. If the pointer is NULL, free can still safely be
called.
Erwin Janssen [Sat, 19 Nov 2016 01:20:46 +0000 (02:20 +0100)]
Fixed: 'dereference before null check' in DotIO.c
When the local variables in the function `convert_edge_labels_to_nodes` in
lib/spare/DotIO.c are initialized, the pointer `g` is dereferenced. But a
the check that tests if `g` is NULL happens after this initialization. The
fix is placing the `if (!g) return NULL` as the first line of the
function, so dereferencing only occurs if the pointer is not NULL.
Erwin Janssen [Sat, 19 Nov 2016 01:06:57 +0000 (02:06 +0100)]
Fixed: 2 'dereference before null check' in SparseMatrix
In the file lib/sparse/SparseMatric.x, there were two functions were a
pointer is dereferenced before checking if the pointer is NULL. The check
`if(!A)` caused an early return in both functions.
The fix is placing the check and the early return as the first line in
both functions. Dereferencing then only occures if the pointer A is not
NULL.
Erwin Janssen [Sat, 19 Nov 2016 00:53:25 +0000 (01:53 +0100)]
Fixed: 'dereference before null check' in stack.c
The pointer `theStack` is dereferenced before the if statement that
checks whether `theStack` is null. This is fixed by placing the variable
declarations in the if statement.
Erwin Janssen [Thu, 17 Nov 2016 16:11:13 +0000 (17:11 +0100)]
Fixed: three memory leaks in neatoinit.c
In the function `makeGraphData()` memory is allocated in various places,
but not all allocated memory is freed at the end of this function. This
commit fixes this by calling `free()` on the pointers `edges`, `edists`
and `ewgts`.
Erwin Janssen [Sun, 13 Nov 2016 20:21:38 +0000 (21:21 +0100)]
Replace WIN32 with _WIN32 in ast, common, dotgen2
WIN32 is defined by the user, _WIN32 is set by the compiler to indicate
the platform. It is better to use the latter.
This commit replaces WIN32 with _WIN32 in source and header files of
lib/ast, lib/common and lib/dotgen2.
The only Autotools check in types.h.in is for `WITH_CGRAPH`, which is
always true for legacy reasons. Therefore we can set this define and turn
it in a regular header file.
Erwin Janssen [Tue, 1 Nov 2016 15:07:02 +0000 (16:07 +0100)]
Remove usage and defintion of __INLINE__
The __INLINE__ definition is used on one place in the code: sfio.h
In this header, some function are defined as inline functions when the
__INLINE__ definition is set. With the current configuration the
__INLINE__ definition is never set, and the inline functions are never
used. Changing the condition so that __INLINE__ does get set, results in
errors during the compilation process. Therefore this defintion can be
removed.
Erwin Janssen [Mon, 31 Oct 2016 21:32:36 +0000 (22:32 +0100)]
Assume `atexit()` can be used, part of standard C
The `atexit()` function is part of standard C, so it can be assumed that
it available. The fallback machanism with `onexit()` is therefore not
needed, which results in less code and defines.
Erwin Janssen [Mon, 31 Oct 2016 14:59:41 +0000 (15:59 +0100)]
Remove `_may_use_threads` from lib/sfio/vthread.h
The define `_may_use_threads` is set after checking some condition, but is
`undef`ed immediately after. The checks that follow only succeed if
`_may_use_threads` is defined, so they all fail and nothing happens. Therefore, the checks of this define and the usage of it can be removed.
Erwin Janssen [Mon, 31 Oct 2016 13:36:47 +0000 (14:36 +0100)]
Remove all usage of _PACKAGE_ast and PACKAGE_ast
These two defines are never set in the configuration or code. Manually
setting them causes the build to fail. Therefore all usage of these
defines can be removed.
Erwin Janssen [Mon, 31 Oct 2016 12:27:02 +0000 (13:27 +0100)]
Remove usage `_hdr_time` & `_sys_time` from sfio
The headers time.h and sys/time.h are not included in the binary build and
are not required for a successfull compilation. The corresponding defines
can therefore also be removed.
Erwin Janssen [Sun, 30 Oct 2016 22:10:21 +0000 (23:10 +0100)]
Replace WIN32 with _WIN32 in cdt, cgraph, pathplan
WIN32 is defined by the user, _WIN32 is set by the compiler to indicate
the platform. It is better to use the latter.
This commit replaces WIN32 with _WIN32 in source and header files of
lib/cdt, lib/cgraph and lib/pathplan.
Erwin Janssen [Fri, 7 Oct 2016 10:35:51 +0000 (12:35 +0200)]
Expanded windows/include/unistd.h
This unistd.h header file is intended to serve as a drop-in replacement
for unistd.h on Windows.
Source: http://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c
According to POSIX, '|' only works as an alternation character in grep
when it is extended regular expression mode (egrep, or grep -E).
This is not an issue most of the time because GNU grep accepts it in
non-extended expressions as well, but other grep implementations
adhering to the standard will fail to match the pattern used to generate
graphviz_version.h.
Switching to EGREP (which also requires not escaping the '|'s) makes it
work for all implementations.
Erwin Janssen [Mon, 5 Dec 2016 01:58:01 +0000 (02:58 +0100)]
Enhanced Travis Nightly Release
Instead of publishing a new release with an "untagged" name on every
Travis build, this configuration will deploy all these nightlies to a
special Nightly release tag.
Erwin Janssen [Mon, 5 Dec 2016 01:10:22 +0000 (02:10 +0100)]
Prevent values like -0 in xdot output
Two graphs in the shapes regression test reference files (invhouse and
invtrapezium) contained a -0 coordinate. The Linux build produced the same
results, but the Windows build didn't, causing the regression tests to
fail.
To prevent values like -0 in the xdot output, a comparison is added just
before formatting the number.
Emden Gansner [Tue, 22 Nov 2016 18:33:28 +0000 (13:33 -0500)]
Update man page, and fix number of nodes in the 2D Sierpinski graph;
fix edge count for 3D Sierpinski in graph_generator.c;
modify CLI to use -S for Sierpinski in any dimension.
Emden Gansner [Thu, 3 Nov 2016 20:57:52 +0000 (16:57 -0400)]
Revert version ffb894f27874ebd510a8555c28083d6e01eb80b6. The fix broke other input (rtest/graphs/url.gv).
Plus it didn't fix the problem of repeated ids. We need to rethink how to handle anchors.
Erwin Janssen [Thu, 3 Nov 2016 00:18:20 +0000 (01:18 +0100)]
Fix: shape coordinates close to 0 now absolutely 0
Check wether the values are close to zero by checking if it lies between
-0.00001 and 0.00001. If this is the case, set the value to 0. This prevents
coordinates like 7.10543e-15, that are differ by platform.
Erwin Janssen [Tue, 11 Oct 2016 10:38:23 +0000 (12:38 +0200)]
Compare output `shapes.py` to reference files
The reference files in `shapes/reference` are generated by the most recent
version of Graphviz. They will serve as a comparison for later versions to
verify the output.
`shapes.py` compares the generated files stored in `output` with the
reference files, by checking equality.
Erwin Janssen [Mon, 10 Oct 2016 22:01:22 +0000 (00:01 +0200)]
Batch file for regression tests for Windows added.
This batch file will execute the new regression tests, for now this only
inclues `shapes.py`. Also added the execution of this file to the Appveyor
configuration.
Instead of checking for the availability of stdint.h and inttypes.h with HAVE_STDINT_H and HAVE_INTTYPES_H, simply include stdint.h. The header stdint.h is part of the C99 standard, so it can be safely assumed that this header is present.
inttypes.h contains everything stdint.h includes, but in all cases here, stdint.h suffices.