From 40d50d693b7049f0d3c357487c947ec86db28934 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sun, 22 Jan 2017 23:06:13 +0100 Subject: [PATCH] [misc] Add small function to swap pointers --- src/misc.c | 8 ++++++++ src/misc.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/misc.c b/src/misc.c index 769b15e2..101c6472 100644 --- a/src/misc.c +++ b/src/misc.c @@ -569,6 +569,14 @@ trimwhitespace(const char *str) return out; } +void +swap_pointers(char **a, char **b) +{ + char *t = *a; + *a = *b; + *b = t; +} + uint32_t djb_hash(const void *data, size_t len) { diff --git a/src/misc.h b/src/misc.h index de1a089e..685a3e14 100644 --- a/src/misc.h +++ b/src/misc.h @@ -82,6 +82,9 @@ unicode_fixup_string(char *str, const char *fromcode); char * trimwhitespace(const char *str); +void +swap_pointers(char **a, char **b); + uint32_t djb_hash(const void *data, size_t len);