+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>
* src/virsh.c: Limit readonly history to 500 to avoid unbounded
*/
virErrorPtr virGetLastError (void);
+virErrorPtr virSaveLastError (void);
void virResetLastError (void);
void virResetError (virErrorPtr err);
+void virFreeError (virErrorPtr err);
virErrorPtr virConnGetLastError (virConnectPtr conn);
void virConnResetLastError (virConnectPtr conn);
} LIBVIRT_0.5.0;
+LIBVIRT_0.6.1 {
+ global:
+ virFreeError;
+ virSaveLastError;
+} LIBVIRT_0.6.0;
+
# .... define new API here using predicted next version number ....
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:
* @err: pointer to the virError to clean up
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: