[Cogl] [PATCH 2/2] error: Don't allocate a new CoglError when propagating
Neil Roberts
neil at linux.intel.com
Mon Nov 19 12:14:56 PST 2012
The cogl_error_propagate function takes ownership of the incoming
error pointer so there's no need to allocate a new error when passing
it on. The errors can potentially be passed up from a number of layers
so it seems worthwhile to avoid the allocation.
---
cogl/cogl-error.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/cogl/cogl-error.c b/cogl/cogl-error.c
index 4ef3681..50829aa 100644
--- a/cogl/cogl-error.c
+++ b/cogl/cogl-error.c
@@ -104,8 +104,12 @@ _cogl_propagate_error (CoglError **dest,
{
_COGL_RETURN_IF_FAIL (src != NULL);
- _cogl_set_error_literal (dest, src->domain, src->code, src->message);
- cogl_error_free (src);
+ if (dest == NULL)
+ cogl_error_free (src);
+ else if (*dest)
+ g_warning (ERROR_OVERWRITTEN_WARNING, src->message);
+ else
+ *dest = src;
}
void
--
1.7.11.3.g3c3efa5
More information about the Cogl
mailing list