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.

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

mercurial