/*1Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.2All rights reserved.34Redistribution and use in source and binary forms, with or without5modification, are permitted provided that the following conditions are6met:78- Redistributions of source code must retain the above copyright9notice, this list of conditions and the following disclaimer.1011- Redistributions in binary form must reproduce the above copyright12notice, this list of conditions and the following disclaimer in13the documentation and/or other materials provided with the14distribution.1516- Neither the name of The Numerical ALgorithms Group Ltd. nor the17names of its contributors may be used to endorse or promote products18derived from this software without specific prior written permission.1920THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS21IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED22TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A23PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER24OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,25EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,26PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR27PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF28LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING29NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS30SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.31*/3233#include "openaxiom-c-macros.h"3435/* memory allocation used by HyperDoc and addfile */3637#include <stdlib.h>38#include <stdio.h>3940#include "halloc.h"414243/* allocate memory and bomb if none left (hyperTeX alloc) */44char *45halloc(int bytes, const char* msg)46{47static char buf[200];48char *result;4950result = (char *) malloc(bytes);51if (result == NULL) {52sprintf(buf, "Ran out of memory allocating %s.\b", msg);53exit(-1);54}55return result;56}575859