diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ouroboros/utils.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/ouroboros/utils.h b/include/ouroboros/utils.h index bd174149..f5f8610d 100644 --- a/include/ouroboros/utils.h +++ b/include/ouroboros/utils.h @@ -25,16 +25,20 @@ #include <stdint.h> #include <unistd.h> +#include <string.h> #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) #define ABS(a) ((a) > 0 ? (a) : -(a)) +#define clrbuf(buf) do { memset(&(buf), 0, sizeof(buf)); } while (0); +#define freebuf(buf) do { free((buf).data); clrbuf(buf); } while (0); typedef struct { uint8_t * data; size_t len; } buffer_t; + /* * Returns the number of characters a uint would * need when represented as a string |