diff options
Diffstat (limited to 'gpgscm/private.h')
-rw-r--r-- | gpgscm/private.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/gpgscm/private.h b/gpgscm/private.h index 5685314..93547ce 100644 --- a/gpgscm/private.h +++ b/gpgscm/private.h @@ -20,6 +20,54 @@ #ifndef GPGSCM_PRIVATE_H #define GPGSCM_PRIVATE_H + +#include "../src/gpgrt.h" + +/* + * Internal i18n macros. + */ +#ifdef ENABLE_NLS +# ifdef HAVE_W32_SYSTEM +# include "gettext.h" +# else +# include <libintl.h> +# endif +# define _(a) gettext (a) +# ifdef gettext_noop +# define N_(a) gettext_noop (a) +# else +# define N_(a) (a) +# endif +#else /*!ENABLE_NLS*/ +# define _(a) (a) +# define N_(a) (a) +#endif /*!ENABLE_NLS */ + +#define xfree(a) gpgrt_free ((a)) +#define xtrymalloc(a) gpgrt_malloc ((a)) +#define xtrycalloc(a,b) gpgrt_calloc ((a),(b)) +#define xtryrealloc(a,b) gpgrt_realloc ((a),(b)) + + +static GPGRT_INLINE void * +xmalloc (size_t n) +{ + void *p = gpgrt_malloc (n); + if (!p) + log_fatal ("malloc failed: %s\n", strerror (errno)); + return p; +} + +static GPGRT_INLINE char * +xstrdup (const char *s) +{ + char *p = gpgrt_malloc (strlen (s) + 1); + strcpy (p, s); + return p; +} + + extern int verbose; + #endif /* GPGSCM_PRIVATE_H */ |