2009-05-02 22:00:54 +02:00
|
|
|
/* Copyright (c) 2008-2009, The Tor Project, Inc. */
|
2008-03-26 17:33:33 +01:00
|
|
|
/* See LICENSE for licensing information */
|
|
|
|
/* Tor dependencies */
|
|
|
|
|
2008-12-29 03:21:02 +01:00
|
|
|
#ifndef _TOR_MEMAREA_H
|
|
|
|
#define _TOR_MEMAREA_H
|
2008-03-26 17:33:33 +01:00
|
|
|
|
|
|
|
typedef struct memarea_t memarea_t;
|
|
|
|
|
2008-11-05 21:34:22 +01:00
|
|
|
memarea_t *memarea_new(void);
|
2008-03-26 17:33:33 +01:00
|
|
|
void memarea_drop_all(memarea_t *area);
|
|
|
|
void memarea_clear(memarea_t *area);
|
|
|
|
int memarea_owns_ptr(const memarea_t *area, const void *ptr);
|
|
|
|
void *memarea_alloc(memarea_t *area, size_t sz);
|
|
|
|
void *memarea_alloc_zero(memarea_t *area, size_t sz);
|
|
|
|
void *memarea_memdup(memarea_t *area, const void *s, size_t n);
|
|
|
|
char *memarea_strdup(memarea_t *area, const char *s);
|
|
|
|
char *memarea_strndup(memarea_t *area, const char *s, size_t n);
|
2008-03-26 18:50:27 +01:00
|
|
|
void memarea_get_stats(memarea_t *area,
|
|
|
|
size_t *allocated_out, size_t *used_out);
|
2008-04-08 19:29:05 +02:00
|
|
|
void memarea_clear_freelist(void);
|
2008-03-26 17:33:33 +01:00
|
|
|
void memarea_assert_ok(memarea_t *area);
|
|
|
|
|
|
|
|
#endif
|
2008-03-26 17:56:37 +01:00
|
|
|
|