| * Author: Tatu Ylonen <ylo@cs.hut.fi> |
| * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
| * Created: Mon Mar 20 21:23:10 1995 ylo |
| * Versions of malloc and friends that check their results, and never return |
| * failure (they call fatal if they encounter an error). |
| RCSID("$Id: xmalloc.c,v 1.2 1999/11/24 13:26:23 damien Exp $"); |
| void *ptr = malloc(size); |
| fatal("xmalloc: out of memory (allocating %d bytes)", (int) size); |
| xrealloc(void *ptr, size_t new_size) |
| fatal("xrealloc: NULL pointer given as argument"); |
| new_ptr = realloc(ptr, new_size); |
| fatal("xrealloc: out of memory (new_size %d bytes)", (int) new_size); |
| fatal("xfree: NULL pointer given as argument"); |
| int len = strlen(str) + 1; |