media/libnestegg/src/halloc.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /*
michael@0 2 * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved.
michael@0 3 *
michael@0 4 * Hierarchical memory allocator, 1.2.1
michael@0 5 * http://swapped.cc/halloc
michael@0 6 */
michael@0 7
michael@0 8 /*
michael@0 9 * The program is distributed under terms of BSD license.
michael@0 10 * You can obtain the copy of the license by visiting:
michael@0 11 *
michael@0 12 * http://www.opensource.org/licenses/bsd-license.php
michael@0 13 */
michael@0 14
michael@0 15 #ifndef _LIBP_HALLOC_H_
michael@0 16 #define _LIBP_HALLOC_H_
michael@0 17
michael@0 18 #include <stddef.h> /* size_t */
michael@0 19
michael@0 20 /*
michael@0 21 * Core API
michael@0 22 */
michael@0 23 void * halloc (void * block, size_t len);
michael@0 24 void hattach(void * block, void * parent);
michael@0 25
michael@0 26 /*
michael@0 27 * standard malloc/free api
michael@0 28 */
michael@0 29 void * h_malloc (size_t len);
michael@0 30 void * h_calloc (size_t n, size_t len);
michael@0 31 void * h_realloc(void * p, size_t len);
michael@0 32 void h_free (void * p);
michael@0 33 char * h_strdup (const char * str);
michael@0 34
michael@0 35 /*
michael@0 36 * the underlying allocator
michael@0 37 */
michael@0 38 typedef void * (* realloc_t)(void * ptr, size_t len);
michael@0 39
michael@0 40 extern realloc_t halloc_allocator;
michael@0 41
michael@0 42 #endif
michael@0 43

mercurial