It is unclear how valuable this is, given this is only applicable to macOS and
its dependency discovery (based on the Autotools behavior) is fairly ad hoc. But
we still drag it into the CMake world to make progress on unifying the Graphviz
build system.
Poppler plugin gvloadimage_poppler_load: fix: match Glib allocation and free
The variable `absolute` is allocated using Glib’s `g_strdup` and friends.
Quoting the Glib docs:¹
It's important to match `g_malloc()` (and wrappers such as `g_new()`) with
`g_free()`, `g_slice_alloc()` (and wrappers such as `g_slice_new()`) with
`g_slice_free()`, plain `malloc()` with `free()`, and (if you're using C++)
`new` with `delete` and `new[]` with `delete[]`. Otherwise bad things can
happen, since these allocators may use different memory pools (and new/delete
call constructors and destructors).
So a custom allocation scheme or arena can be in play. Basically if you
`g_strdup` and then pair this with `free` (as was done in the code prior to this
commit), you risk leaking memory from the Glib pool and corrupting your system
allocator.
Having said that, this is no longer a concern in newer Glib:
Since GLib 2.46 `g_malloc()` is hardcoded to always use the system malloc
implementation.
03a5c3621e3185e4ca116805317a98cdc8595443 introduced another usage of the format
specifier `%zu` which has some compatibility issues on Windows. This change
switches to what it should have done to begin with, used the compatibility shim.
Costa Shulyupin [Sun, 3 Apr 2022 08:10:56 +0000 (11:10 +0300)]
squash warning in mm_read_unsymmetric_sparse
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
Costa Shulyupin [Sun, 3 Apr 2022 08:10:41 +0000 (11:10 +0300)]
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_COMPLEX
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
Costa Shulyupin [Sun, 3 Apr 2022 08:10:29 +0000 (11:10 +0300)]
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_PATTERN
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
Costa Shulyupin [Sun, 3 Apr 2022 08:08:47 +0000 (11:08 +0300)]
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_INTEGER
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
Costa Shulyupin [Sun, 3 Apr 2022 08:04:41 +0000 (11:04 +0300)]
squash warning in SparseMatrix_import_matrix_market/MATRIX_TYPE_REAL
warning: ignoring return value of ‘fscanf’, declared with attribute warn_unused_result [-Wunused-result]
On success, these functions return the number of input items
successfully matched and assigned; this can be fewer than
provided for, or even zero, in the event of an early
matching failure.
CMake: standardize on always specifying library paths in 'install' steps
Given the differences in how Windows vs everything else treats library vs binary
paths, it seems clearer and less confusing to always specify `RUNTIME`,
`LIBRARY`, and `ARCHIVE` paths during `install` steps. This also avoids
accidentally installing libraries to incorrect paths if they are considered for
installation as dependents of a binary, though I do not know whether this
behavior ever occurs.
`target_include_directories` supports relative paths that are interpreted
relative to the current source directory. So we can write these paths shorter
and more obviously.
The third-party library Svgpp calls Boost in a way that is deprecated, resulting
in compiler warnings during the CMake build. This change teaches CMake that none
of this is our code and we do not want to be warned about it.
Given the prior commit rewrote every byte in this file, we may as well also fix
the odd white space decisions here while we are at it. Though it is unclear who
if anyone uses this tool any more.
Of all the source files in the Graphviz tree, this file alone was encoded in
UTF-16 with a BOM.¹ BOMs have mostly fallen out of favor these days, with people
preferring to let the host operating system or locale determine encoding. Git
will happily translate text files to your local encoding on checkout. With that
in mind, we can convert this file to UTF-8 and stop forcing developers on other
operating systems to pay the price for Windows’ poor past decisions.
xlib plugin handle_file_events: more tightly scope a long-lived dynamic buffer
This buffer was being retained in a long-lived `static` pointer, increasing peak
memory usage and making it harder to use tools like Valgrind and ASan with
Graphviz. This change makes it more obvious to both users and tools what this
buffer is used for.
Note this also tweaks an error message to be more informative.