[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/4] Error: Introduce error_copy()
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PATCH 2/4] Error: Introduce error_copy() |
Date: |
Fri, 9 Mar 2012 15:13:04 -0300 |
Signed-off-by: Luiz Capitulino <address@hidden>
---
error.c | 13 +++++++++++++
error.h | 5 +++++
2 files changed, 18 insertions(+)
diff --git a/error.c b/error.c
index 990050f..d3455ab 100644
--- a/error.c
+++ b/error.c
@@ -43,6 +43,19 @@ void error_set(Error **errp, const char *fmt, ...)
*errp = err;
}
+Error *error_copy(const Error *err)
+{
+ Error *err_new;
+
+ err_new = g_malloc0(sizeof(*err));
+ err_new->msg = g_strdup(err->msg);
+ err_new->fmt = err->fmt;
+ err_new->obj = err->obj;
+ QINCREF(err_new->obj);
+
+ return err_new;
+}
+
bool error_is_set(Error **errp)
{
return (errp && *errp);
diff --git a/error.h b/error.h
index 6361f40..45ff6c1 100644
--- a/error.h
+++ b/error.h
@@ -35,6 +35,11 @@ void error_set(Error **err, const char *fmt, ...)
GCC_FMT_ATTR(2, 3);
bool error_is_set(Error **err);
/**
+ * Returns an exact copy of the error passed as an argument.
+ */
+Error *error_copy(const Error *err);
+
+/**
* Get a human readable representation of an error object.
*/
const char *error_get_pretty(Error *err);
--
1.7.9.2.384.g4a92a
- [Qemu-devel] [PATCH v2 0/4] qapi: Convert migrate, Luiz Capitulino, 2012/03/09
- [Qemu-devel] [PATCH 1/4] QError: Introduce new errors for the migration command, Luiz Capitulino, 2012/03/09
- [Qemu-devel] [PATCH 2/4] Error: Introduce error_copy(),
Luiz Capitulino <=
- [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Luiz Capitulino, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Jan Kiszka, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Luiz Capitulino, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Jan Kiszka, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Anthony Liguori, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Luiz Capitulino, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Luiz Capitulino, 2012/03/09
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Kevin Wolf, 2012/03/12
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Luiz Capitulino, 2012/03/12
- Re: [Qemu-devel] [PATCH 3/4] Purge migration of (almost) everything to do with monitors, Anthony Liguori, 2012/03/09