Skip to content
Snippets Groups Projects
Commit 70fb5035 authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

[dnssec] move gnutls_datum_t cleanup macro to shared.h

parent f0d280eb
Branches
Tags
1 merge request!332libdnssec
......@@ -12,17 +12,6 @@
#include "shared.h"
#include "wire.h"
// INTERNAL API (crypto dependent)
// auto cleanup functions
static void free_datum(gnutls_datum_t *ptr)
{
gnutls_free(ptr->data);
}
#define _cleanup_datum_ _cleanup_(free_datum)
// internal
/**
......
......@@ -4,6 +4,8 @@
#include <stdlib.h>
#include <unistd.h>
#include <gnutls/gnutls.h>
#define _public_ __attribute__((visibility("default")))
#define _hidden_ __attribute__((visibility("hidden")))
......@@ -16,6 +18,8 @@
*/
#define clear_struct(pointer) memset((pointer), '\0', sizeof(*(pointer)))
/* -- cleanup macros ------------------------------------------------------- */
#define _cleanup_(var) __attribute__((cleanup(var)))
static inline void close_ptr(int *ptr)
......@@ -36,6 +40,12 @@ static inline void free_ptr(void *ptr)
free(*(void **)ptr);
}
static inline void free_gnutls_datum_ptr(gnutls_datum_t *ptr)
{
gnutls_free(ptr->data);
}
#define _cleanup_free_ _cleanup_(free_ptr)
#define _cleanup_fclose_ _cleanup_(fclose_ptr)
#define _cleanup_fclose_ _cleanup_(fclose_ptr)
#define _cleanup_datum_ _cleanup_(free_gnutls_datum_ptr)
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