Introduce virErrorCopyNew

A helper function for copying error objects.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2015-07-10 08:44:41 +02:00
parent a7c22a1f29
commit 9d0a2af6c2
4 changed files with 19 additions and 0 deletions

View File

@ -102,6 +102,7 @@ ignored_functions = {
"virDomainMigratePrepare3Params": "private function for migration", "virDomainMigratePrepare3Params": "private function for migration",
"virDomainMigrateConfirm3Params": "private function for migration", "virDomainMigrateConfirm3Params": "private function for migration",
"virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration", "virDomainMigratePrepareTunnel3Params": "private function for tunnelled migration",
"virErrorCopyNew": "private",
} }
ignored_macros = { ignored_macros = {

View File

@ -1365,6 +1365,7 @@ ebtablesRemoveForwardAllowIn;
# util/virerror.h # util/virerror.h
virDispatchError; virDispatchError;
virErrorCopyNew;
virErrorInitialize; virErrorInitialize;
virErrorSetErrnoFromLastError; virErrorSetErrnoFromLastError;
virLastErrorIsSystemErrno; virLastErrorIsSystemErrno;

View File

@ -214,6 +214,22 @@ virCopyError(virErrorPtr from,
return ret; return ret;
} }
virErrorPtr
virErrorCopyNew(virErrorPtr err)
{
virErrorPtr ret;
if (VIR_ALLOC_QUIET(ret) < 0)
return NULL;
if (virCopyError(err, ret) < 0)
VIR_FREE(ret);
return ret;
}
static virErrorPtr static virErrorPtr
virLastErrorObject(void) virLastErrorObject(void)
{ {

View File

@ -185,6 +185,7 @@ void virReportOOMErrorFull(int domcode,
virRaiseErrorObject(__FILE__, __FUNCTION__, __LINE__, obj) virRaiseErrorObject(__FILE__, __FUNCTION__, __LINE__, obj)
int virSetError(virErrorPtr newerr); int virSetError(virErrorPtr newerr);
virErrorPtr virErrorCopyNew(virErrorPtr err);
void virDispatchError(virConnectPtr conn); void virDispatchError(virConnectPtr conn);
const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen); const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen);