3 % Copyright
1996-2006 Han The Thanh
<thanh@@pdftex.org
>
4 % Copyright
2006-2009 Taco Hoekwater
<taco@@luatex.org
>
6 % This file is part of LuaTeX.
8 % LuaTeX is free software
; you can redistribute it and
/or modify it under
9 % the terms of the GNU General Public License as published by the Free
10 % Software Foundation
; either version
2 of the License
, or
(at your
11 % option
) any later version.
13 % LuaTeX is distributed in the hope that it will be useful
, but WITHOUT
14 % ANY WARRANTY
; without even the implied warranty of MERCHANTABILITY or
15 % FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 % License for more details.
18 % You should have received a copy of the GNU General Public License along
19 % with LuaTeX
; if not
, see
<http
://www.gnu.org
/licenses
/>.
21 @
* AVL helper functions.
27 #include
"utils/avl.h"
29 @ memory management functions for AVL
31 static void
*avl_xmalloc
(struct libavl_allocator
*allocator
, size_t size
)
33 assert
(allocator
!= NULL && size > 0);
34 return xmalloc
((unsigned
) size
);
37 static void avl_xfree
(struct libavl_allocator
*allocator
, void
*block
)
39 assert
(allocator
!= NULL && block != NULL);
43 struct libavl_allocator avl_xallocator
= {
48 @ general AVL comparison functions
50 int comp_int_entry
(const void
*pa
, const void
*pb
, void
*p
)
53 cmp_return
(*(const int
*) pa
, *(const int
*) pb
);
57 int comp_string_entry
(const void
*pa
, const void
*pb
, void
*p
)
60 return strcmp
((const char
*) pa
, (const char
*) pb
);