mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-04-26 15:14:42 +00:00
introduce virSaveLastError(), virFreeError()
This commit is contained in:
parent
1290b28f59
commit
fa7f51b813
@ -1,3 +1,9 @@
|
|||||||
|
Mon Feb 9 14:07:51 GMT 2009 John Levon <john.levon@sun.com>
|
||||||
|
|
||||||
|
* include/libvirt/virterror.h:
|
||||||
|
* src/libvirt_public.syms:
|
||||||
|
* src/virterror.c: introduce virSaveLastError(), virFreeError()
|
||||||
|
|
||||||
Mon Feb 9 10:21:33 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
Mon Feb 9 10:21:33 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
|
||||||
|
|
||||||
* src/virsh.c: Limit readonly history to 500 to avoid unbounded
|
* src/virsh.c: Limit readonly history to 500 to avoid unbounded
|
||||||
|
@ -172,8 +172,10 @@ typedef void (*virErrorFunc) (void *userData, virErrorPtr error);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
virErrorPtr virGetLastError (void);
|
virErrorPtr virGetLastError (void);
|
||||||
|
virErrorPtr virSaveLastError (void);
|
||||||
void virResetLastError (void);
|
void virResetLastError (void);
|
||||||
void virResetError (virErrorPtr err);
|
void virResetError (virErrorPtr err);
|
||||||
|
void virFreeError (virErrorPtr err);
|
||||||
|
|
||||||
virErrorPtr virConnGetLastError (virConnectPtr conn);
|
virErrorPtr virConnGetLastError (virConnectPtr conn);
|
||||||
void virConnResetLastError (virConnectPtr conn);
|
void virConnResetLastError (virConnectPtr conn);
|
||||||
|
@ -247,4 +247,10 @@ LIBVIRT_0.6.0 {
|
|||||||
|
|
||||||
} LIBVIRT_0.5.0;
|
} LIBVIRT_0.5.0;
|
||||||
|
|
||||||
|
LIBVIRT_0.6.1 {
|
||||||
|
global:
|
||||||
|
virFreeError;
|
||||||
|
virSaveLastError;
|
||||||
|
} LIBVIRT_0.6.0;
|
||||||
|
|
||||||
# .... define new API here using predicted next version number ....
|
# .... define new API here using predicted next version number ....
|
||||||
|
@ -285,6 +285,27 @@ virCopyLastError(virErrorPtr to)
|
|||||||
return to->code;
|
return to->code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virSaveLastError:
|
||||||
|
*
|
||||||
|
* Save the last error into a new error object.
|
||||||
|
*
|
||||||
|
* Returns a pointer to the copied error or NULL if allocation failed.
|
||||||
|
* It is the caller's responsibility to free the error with
|
||||||
|
* virFreeError().
|
||||||
|
*/
|
||||||
|
virErrorPtr
|
||||||
|
virSaveLastError(void)
|
||||||
|
{
|
||||||
|
virErrorPtr to;
|
||||||
|
|
||||||
|
if (VIR_ALLOC(to) < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
virCopyLastError(to);
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virResetError:
|
* virResetError:
|
||||||
* @err: pointer to the virError to clean up
|
* @err: pointer to the virError to clean up
|
||||||
@ -303,6 +324,18 @@ virResetError(virErrorPtr err)
|
|||||||
memset(err, 0, sizeof(virError));
|
memset(err, 0, sizeof(virError));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virFreeError:
|
||||||
|
* @err: error to free
|
||||||
|
*
|
||||||
|
* Resets and frees the given error.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
virFreeError(virErrorPtr err)
|
||||||
|
{
|
||||||
|
virResetError(err);
|
||||||
|
VIR_FREE(err);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virResetLastError:
|
* virResetLastError:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user