diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2011-12-05 16:04:05 -0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2012-03-15 10:39:52 -0300 |
commit | 79020cfcbb78a85768174bb93ee3b7cfc6ffa353 (patch) | |
tree | dcdc84f21626931efe67bfa3296850d7cc45d991 /error.c | |
parent | a4acc064f7054877aeffe0ea27a492b15086b833 (diff) |
Error: Introduce error_copy()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -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); |