Commit 80ae8014 authored by Anatol Pomozov's avatar Anatol Pomozov Committed by Allan McRae
Browse files

Add GOTO_ERR() macro to set error and then goto a label



This is a macro similar to RET_ERR but useful in the case when we need
to record an error and then jump to some cleanup section.
Signed-off-by: Anatol Pomozov's avatarAnatol Pomozov <anatol.pomozov@gmail.com>
Signed-off-by: Allan McRae's avatarAllan McRae <allan@archlinux.org>
parent 0deff63e
...@@ -71,6 +71,11 @@ void _alpm_alloc_fail(size_t size); ...@@ -71,6 +71,11 @@ void _alpm_alloc_fail(size_t size);
(handle)->pm_errno = (err); \ (handle)->pm_errno = (err); \
return (ret); } while(0) return (ret); } while(0)
#define GOTO_ERR(handle, err, label) do { \
_alpm_log(handle, ALPM_LOG_DEBUG, "got error %d at %s (%s: %d) : %s\n", err, __func__, __FILE__, __LINE__, alpm_strerror(err)); \
(handle)->pm_errno = (err); \
goto label; } while(0)
#define RET_ERR_ASYNC_SAFE(handle, err, ret) do { \ #define RET_ERR_ASYNC_SAFE(handle, err, ret) do { \
(handle)->pm_errno = (err); \ (handle)->pm_errno = (err); \
return (ret); } while(0) return (ret); } while(0)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment