aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/utils.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-04-15 16:59:25 +0200
committerMartin Willi <martin@revosec.ch>2015-04-16 14:50:40 +0200
commit04f12ecd296287f433405078c520d5cbf073fcd9 (patch)
tree93864191fb8e20730f1ea930ab41688ab9f23f1f /src/libstrongswan/utils/utils.c
parenteaa02bc925803151976375bbbb195d7c772302d7 (diff)
downloadstrongswan-04f12ecd296287f433405078c520d5cbf073fcd9.tar.bz2
strongswan-04f12ecd296287f433405078c520d5cbf073fcd9.tar.xz
align: Move min/max/padding/alignment functions to separate files
Diffstat (limited to 'src/libstrongswan/utils/utils.c')
-rw-r--r--src/libstrongswan/utils/utils.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/libstrongswan/utils/utils.c b/src/libstrongswan/utils/utils.c
index 3de663a4a..e3a16c0f0 100644
--- a/src/libstrongswan/utils/utils.c
+++ b/src/libstrongswan/utils/utils.c
@@ -28,56 +28,11 @@
#endif
#include <library.h>
-#include <utils/debug.h>
#include <utils/chunk.h>
#include <collections/enumerator.h>
#include <threading/mutex.h>
#include <threading/condvar.h>
-/**
- * Described in header.
- */
-void* malloc_align(size_t size, u_int8_t align)
-{
- u_int8_t pad;
- void *ptr;
-
- if (align == 0)
- {
- align = 1;
- }
- ptr = malloc(align + sizeof(pad) + size);
- if (!ptr)
- {
- return NULL;
- }
- /* store padding length just before data, down to the allocation boundary
- * to do some verification during free_align() */
- pad = align - ((uintptr_t)ptr % align);
- memset(ptr, pad, pad);
- return ptr + pad;
-}
-
-/**
- * Described in header.
- */
-void free_align(void *ptr)
-{
- u_int8_t pad, *pos;
-
- pos = ptr - 1;
- /* verify padding to check any corruption */
- for (pad = *pos; (void*)pos >= ptr - pad; pos--)
- {
- if (*pos != pad)
- {
- DBG1(DBG_LIB, "!!!! invalid free_align() !!!!");
- return;
- }
- }
- free(ptr - pad);
-}
-
#ifdef WIN32
/**