|
|
1.1 root 1: /* GNU Objective C Runtime Miscellanious 1.1.1.2 ! root 2: Copyright (C) 1993, 1994 Free Software Foundation, Inc. 1.1 root 3: 4: Author: Kresten Krab Thorup 5: 6: This file is part of GNU CC. 7: 8: GNU CC is free software; you can redistribute it and/or modify it under the 9: terms of the GNU General Public License as published by the Free Software 10: Foundation; either version 2, or (at your option) any later version. 11: 12: GNU CC is distributed in the hope that it will be useful, but WITHOUT ANY 13: WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14: FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15: details. 16: 17: You should have received a copy of the GNU General Public License along with 18: GNU CC; see the file COPYING. If not, write to the Free Software 19: Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 20: 21: /* As a special exception, if you link this library with files compiled with 22: GCC to produce an executable, this does not cause the resulting executable 23: to be covered by the GNU General Public License. This exception does not 24: however invalidate any other reasons why the executable file might be 25: covered by the GNU General Public License. */ 26: 27: #include "runtime.h" 28: 29: void objc_error(id object, const char* fmt, va_list); 30: 31: void (*_objc_error)(id, const char*, va_list) = objc_error; 32: 1.1.1.2 ! root 33: #ifdef __alpha__ ! 34: #include <stdlib.h> ! 35: extern int write (int, const char*, int); ! 36: extern size_t strlen (const char*); ! 37: #endif ! 38: 1.1 root 39: void 40: objc_error(id object, const char* fmt, va_list ap) 41: { 42: vfprintf (stderr, fmt, ap); 43: abort (); 44: } 45: 46: volatile void 47: objc_fatal(const char* msg) 48: { 1.1.1.2 ! root 49: write(2, msg, (int)strlen((const char*)msg)); 1.1 root 50: abort(); 51: } 52: 53: void* 54: __objc_xmalloc(size_t size) 55: { 56: void* res = (void*) malloc(size); 57: if(!res) 58: objc_fatal("Virtual memory exhausted\n"); 59: return res; 60: } 61: 62: void* 63: __objc_xrealloc(void* mem, size_t size) 64: { 65: void* res = (void*) realloc(mem, size); 66: if(!res) 67: objc_fatal("Virtual memory exhausted\n"); 68: return res; 69: } 70: 71: void* 72: __objc_xcalloc(size_t nelem, size_t size) 73: { 74: void* res = (void*)calloc(nelem, size); 75: if(!res) 76: objc_fatal("Virtual memory exhausted\n"); 77: return res; 78: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.