--- /dev/null
+#ifndef __ALLOCWITHIN_INT_H__
+#define __ALLOCWITHIN_INT_H__
+
+/**
+ * $Id$
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#ifdef HAVE_LIBPTHREAD
+#include <pthread.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef STDC_HEADERS
+#include <stdio.h>
+#include <errno.h>
+#endif
+
+#include "allocwithin.h"
+
+#ifdef HAVE___ATTRIBUTE__
+#define UNUSED __attribute__((__unused__))
+#endif
+
+struct allocw_block_
+{
+ size_t size; /* total bytes of this block, including this header struct */
+ allocw_id_t next_off; /* byte-offset of next block, from start-of-region */
+ allocw_id_t prev_off; /* byte-offset of prev block, from start-of-region */
+ char data_[]; /* user data follows this header struct */
+};
+
+struct allocw_region_
+{
+ size_t size; /* total bytes of this region, including this header struct */
+ allocw_id_t free_start; /* first free block */
+ allocw_id_t free_end; /* last free block */
+ pthread_mutex_t freelist_mutex; /* mutex for accessing freelist */
+ unsigned int num_alloced; /* number of outstanding allocations */
+ char data_[]; /* blocks follow this header struct */
+};
+
+/* convert an id into a region to a pointer */
+#define BLOCK_PTR(__region, __id) ( (struct allocw_block_ *)((char *)(__region) + (__id)) )
+
+/* convert a pointer to a block in a region to an id */
+#define BLOCK_OFF(__region, __block) ( (void *)(__block) - (void *)(__region) )
+
+#endif /* __ALLOCWITHIN_INT_H__ */