util: replace strerror/strerror_r with g_strerror

g_strerror is offers the safety/correctness benefits of strerror_r, with
the API design convenience of strerror.

Use of virStrerror should be eliminated through the codebase in favour
of g_strerror.

commandhelper.c is a special case as its a tiny single threaded test
program, not linked to glib, so it just uses traditional strerror().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrangé
2019-10-02 16:30:36 +01:00
parent 71efb59a4d
commit c4d18e8b3e
10 changed files with 25 additions and 21 deletions

View File

@@ -1051,6 +1051,10 @@ BAD:
<dd>The GLib macros g_autoptr and G_DEFINE_AUTOPTR_CLEANUP_FUNC
should be used to manage autoclean of virObject classes.
This matches usage with GObject classes.</dd>
<dt>virStrerror</dt>
<dd>The GLib g_strerror() function should be used instead,
which has a simpler calling convention as an added benefit.</dd>
</dl>
<h2><a id="file_handling">File handling</a></h2>