cgraph: rewrite 'aglasterr' to operate in-memory
aglasterr
was using a temporary file to stash the last warning/error message.
There were numerous downsides to this:
-
Warnings/errors would result in unnecessary disk I/O. This puts extra wear on storage devices, decreases efficiency, and puts the operating system’s I/O subsystem on the path to Graphviz printing a warning/error.
-
During a run of Graphviz, the temporary file is never truncated or overwritten. Large warning/error output would gradually fill the user’s disk.
-
If the current environment has no temporary directory (or an entirely read-only file system) or the maximum number of temporary files has been exceeded, this mechanism would fail.
This change avoids the above issues by maintaining the last warning/error message in an in-memory buffer.