00001 /* LibHnj is dual licensed under LGPL and MPL. Boilerplate for both 00002 * licenses follows. 00003 */ 00004 00005 /* LibHnj - a library for high quality hyphenation and justification 00006 * Copyright (C) 1998 Raph Levien, (C) 2001 ALTLinux, Moscow 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Library General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Library General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Library General Public 00019 * License along with this library; if not, write to the 00020 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00021 * Boston, MA 02110-1301 USA. 00022 */ 00023 00024 /* 00025 * The contents of this file are subject to the Mozilla Public License 00026 * Version 1.0 (the "MPL"); you may not use this file except in 00027 * compliance with the MPL. You may obtain a copy of the MPL at 00028 * http://www.mozilla.org/MPL/ 00029 * 00030 * Software distributed under the MPL is distributed on an "AS IS" basis, 00031 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL 00032 * for the specific language governing rights and limitations under the 00033 * MPL. 00034 * 00035 */ 00036 /* wrappers for malloc */ 00037 00038 #include <stdlib.h> 00039 #include <stdio.h> 00040 00041 void * 00042 hnj_malloc (int size) 00043 { 00044 void *p; 00045 00046 p = malloc (size); 00047 if (p == NULL) 00048 { 00049 fprintf (stderr, "can't allocate %d bytes\n", size); 00050 exit (1); 00051 } 00052 return p; 00053 } 00054 00055 void * 00056 hnj_realloc (void *p, int size) 00057 { 00058 p = realloc (p, size); 00059 if (p == NULL) 00060 { 00061 fprintf (stderr, "can't allocate %d bytes\n", size); 00062 exit (1); 00063 } 00064 return p; 00065 } 00066 00067 void 00068 hnj_free (void *p) 00069 { 00070 free (p); 00071 } 00072