|
|
1.1 root 1: /* GNU Objective C Runtime Miscellanious
2: Copyright (C) 1993 Free Software Foundation, Inc.
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:
33: void
34: objc_error(id object, const char* fmt, va_list ap)
35: {
36: vfprintf (stderr, fmt, ap);
37: abort ();
38: }
39:
40: volatile void
41: objc_fatal(const char* msg)
42: {
43: write(2, msg, (size_t)strlen((char*)msg));
44: abort();
45: }
46:
47: void*
48: __objc_xmalloc(size_t size)
49: {
50: void* res = (void*) malloc(size);
51: if(!res)
52: objc_fatal("Virtual memory exhausted\n");
53: return res;
54: }
55:
56: void*
57: __objc_xrealloc(void* mem, size_t size)
58: {
59: void* res = (void*) realloc(mem, size);
60: if(!res)
61: objc_fatal("Virtual memory exhausted\n");
62: return res;
63: }
64:
65: void*
66: __objc_xcalloc(size_t nelem, size_t size)
67: {
68: void* res = (void*)calloc(nelem, size);
69: if(!res)
70: objc_fatal("Virtual memory exhausted\n");
71: return res;
72: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.