From 79020cfcbb78a85768174bb93ee3b7cfc6ffa353 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 5 Dec 2011 16:04:05 -0200 Subject: Error: Introduce error_copy() Signed-off-by: Luiz Capitulino --- error.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 990050f792..d3455ab9e6 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); -- cgit v1.2.3