other-licenses/android/heap.h

branch
TOR_BUG_9701
changeset 8
97036ab72558
equal deleted inserted replaced
-1:000000000000 0:6685b8d75278
1 /* $NetBSD: heap.h,v 1.1.1.1 2004/05/20 19:49:41 christos Exp $ */
2
3 /*
4 * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (c) 1997,1999 by Internet Software Consortium.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20 /*
21 * This version of this file is derived from Android 2.3 "Gingerbread",
22 * which contains uncredited changes by Android/Google developers. It has
23 * been modified in 2011 for use in the Android build of Mozilla Firefox by
24 * Mozilla contributors (including Michael Edwards <m.k.edwards@gmail.com>,
25 * and Steve Workman <sjhworkman@gmail.com>).
26 * These changes are offered under the same license as the original NetBSD
27 * file, whose copyright and license are unchanged above.
28 */
29
30 typedef int (*heap_higher_priority_func)(void *, void *);
31 typedef void (*heap_index_func)(void *, int);
32 typedef void (*heap_for_each_func)(void *, void *);
33
34 typedef struct heap_context {
35 int array_size;
36 int array_size_increment;
37 int heap_size;
38 void **heap;
39 heap_higher_priority_func higher_priority;
40 heap_index_func index;
41 } *heap_context;
42
43 #define heap_new __heap_new
44 #define heap_free __heap_free
45 #define heap_insert __heap_insert
46 #define heap_delete __heap_delete
47 #define heap_increased __heap_increased
48 #define heap_decreased __heap_decreased
49 #define heap_element __heap_element
50 #define heap_for_each __heap_for_each
51
52 heap_context heap_new(heap_higher_priority_func, heap_index_func, int);
53 int heap_free(heap_context);
54 int heap_insert(heap_context, void *);
55 int heap_delete(heap_context, int);
56 int heap_increased(heap_context, int);
57 int heap_decreased(heap_context, int);
58 void * heap_element(heap_context, int);
59 int heap_for_each(heap_context, heap_for_each_func, void *);

mercurial