libvirt/include
Daniel P. Berrange 9b3455cb78 Add a virGetLastErrorMessage() function
Apps using libvirt will often have code like

   if (virXXXX() < 0) {
      virErrorPtr err = virGetLastError();
      fprintf(stderr, "Something failed: %s\n",
              err && err->message ? err->message :
              "unknown error");
      return -1;
   }

Checking for a NULL error object or message leads to very
verbose code. A virGetLastErrorMessage() helper from libvirt
can simplify this to

   if (virXXXX() < 0) {
      fprintf(stderr, "Something failed: %s\n",
              virGetLastErrorMessage());
      return -1;
   }

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
(cherry picked from commit 69c6a58a1d)
2013-06-12 16:37:55 -04:00
..
libvirt Add a virGetLastErrorMessage() function 2013-06-12 16:37:55 -04:00
Makefile.am maint: add missing copyright notices 2011-07-28 15:01:17 -06:00