aboutsummaryrefslogtreecommitdiffstats
path: root/internal.h
blob: c8d97382306f24157c96960e907da3abc99e7b7a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* See LICENSE file for copyright and license details. */
#include "liberror-gpgme.h"

#include <liberror.h>
#include <errno.h>
#include <stddef.h>


#if defined(__GNUC__)
# define GCC_ATTRIBUTES(...) __attribute__((__VA_ARGS__))
#else
# define GCC_ATTRIBUTES(...)
#endif

#define HIDDEN GCC_ATTRIBUTES(__visibility__("hidden"))


#define liberror_gpgme_set_error(FUNC, CODE)\
	do {\
		char desc__[256];\
		int saved_errno__ = errno;\
		liberror_save_backtrace(NULL);\
		gpgme_strerror_r(CODE, desc__, sizeof(desc__));\
		desc__[255] = '\0';\
		liberror_set_error(desc__, FUNC, "libgpg-error", CODE);\
		errno = saved_errno__;\
	} while (0)