[libvirt PATCH 2/4] util: remove virStrerror

Ján Tomko posted 4 patches 4 years, 8 months ago
[libvirt PATCH 2/4] util: remove virStrerror
Posted by Ján Tomko 4 years, 8 months ago
Now that we use g_strerror exclusively, remove this unused
function.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/libvirt_private.syms |  1 -
 src/util/virerror.c      | 25 -------------------------
 src/util/virerror.h      |  2 --
 3 files changed, 28 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 511fb88872..22f6d14ced 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1981,7 +1981,6 @@ virReportOOMErrorFull;
 virReportSystemErrorFull;
 virSetError;
 virSetErrorLogPriorityFunc;
-virStrerror;
 
 
 # util/vireventglib.h
diff --git a/src/util/virerror.c b/src/util/virerror.c
index 16c384d2f9..774c36bca3 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -1307,31 +1307,6 @@ void virReportErrorHelper(int domcode,
     errno = save_errno;
 }
 
-/**
- * virStrerror:
- * @theerrno: the errno value
- * @errBuf: the buffer to save the error to
- * @errBufLen: the buffer length
- *
- * Generate an error string for the given errno
- *
- * Returns a pointer to the error string, possibly indicating that the
- *         error is unknown
- */
-const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen)
-{
-    int save_errno = errno;
-    const char *ret;
-    const char *str = g_strerror(theerrno);
-    size_t len = strlen(str);
-
-    memcpy(errBuf, str, MIN(len, errBufLen));
-    errBuf[errBufLen-1] = '\0';
-    ret = errBuf;
-    errno = save_errno;
-    return ret;
-}
-
 /**
  * virReportSystemErrorFull:
  * @domcode: the virErrorDomain indicating where it's coming from
diff --git a/src/util/virerror.h b/src/util/virerror.h
index 2e27655b72..9d3e40d65a 100644
--- a/src/util/virerror.h
+++ b/src/util/virerror.h
@@ -192,8 +192,6 @@ void virReportOOMErrorFull(int domcode,
 int virSetError(virErrorPtr newerr);
 virErrorPtr virErrorCopyNew(virErrorPtr err);
 void virDispatchError(virConnectPtr conn);
-/* DEPRECATED: use g_strerror() directly */
-const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);
 
 typedef int (*virErrorLogPriorityFunc)(virErrorPtr, int);
 void virSetErrorLogPriorityFunc(virErrorLogPriorityFunc func);
-- 
2.24.1