Debian Codegraph @

texk/web2c/luatexdir/lang/hnjalloc.c

raw
1 /*
2
3 hnjalloc.w
4
5 LibHnj is dual licensed under LGPL and MPL. Boilerplate for both licenses
6 follows.
7
8 LibHnj - a library for high quality hyphenation and justification Copyright (C)
9 1998 Raph Levien, (C) 2001 ALTLinux, Moscow
10
11 This library is free software; you can redistribute it and/or modify it under the
12 terms of the GNU Library General Public License as published by the Free Software
13 Foundation; either version 2 of the License, or (at your option) any later
14 version.
15
16 This library is distributed in the hope that it will be useful, but WITHOUT ANY
17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
18 PARTICULAR PURPOSE. See the GNU Library General Public License for more details.
19
20 You should have received a copy of the GNU Library General Public License along
21 with this library; if not, write to the Free Software Foundation, Inc., 59 Temple
22 Place - Suite 330, Boston, MA 02111-1307 USA.
23
24 The contents of this file are subject to the Mozilla Public License Version 1.0
25 (the "MPL"); you may not use this file except in compliance with the MPL. You may
26 obtain a copy of the MPL at http://www.mozilla.org/MPL/
27
28 Software distributed under the MPL is distributed on an "AS IS" basis, WITHOUT
29 WARRANTY OF ANY KIND, either express or implied. See the MPL for the specific
30 language governing rights and limitations under the MPL.
31
32 */
33
34 /*tex The wrappers for malloc */
35
36 #include <stdlib.h>
37 #include <stdio.h>
38 #include "lang/hnjalloc.h"
39
40 void *hnj_malloc(int size)
41 {
42 void *p;
43
44 p = malloc((size_t) size);
45 if (p == NULL) {
46 fprintf(stderr, "can't allocate %d bytes\n", size);
47 exit(1);
48 }
49 return p;
50 }
51
52 void *hnj_realloc(void *p, int size)
53 {
54 p = realloc(p, (size_t) size);
55 if (p == NULL) {
56 fprintf(stderr, "can't allocate %d bytes\n", size);
57 exit(1);
58 }
59 return p;
60 }
61
62 void hnj_free(void *p)
63 {
64 free(p);
65 }