|
|
1.1 root 1: /*
2: * UAE - The Un*x Amiga Emulator
3: *
4: * Various stuff missing in some OSes.
5: *
6: * Copyright 1997 Bernd Schmidt
7: */
8:
9: #include "sysconfig.h"
10: #include "sysdeps.h"
11:
12: #include "config.h"
13: #include "options.h"
14: #include "uae.h"
15:
16: #ifndef HAVE_STRDUP
17:
18: char *my_strdup (const char *s)
19: {
20: /* The casts to char * are there to shut up the compiler on HPUX */
21: char *x = (char*)xmalloc(strlen((char *)s) + 1);
22: strcpy(x, (char *)s);
23: return x;
24: }
25:
26: #endif
27:
1.1.1.3 ! root 28: void *xmalloc (size_t n)
1.1 root 29: {
30: void *a = malloc (n);
31: if (a == NULL) {
1.1.1.2 root 32: fprintf (stderr, "virtual memory exhausted\n");
33: abort ();
1.1 root 34: }
35: return a;
36: }
1.1.1.3 ! root 37:
! 38: void *xcalloc (size_t n, size_t size)
! 39: {
! 40: void *a = calloc (n, size);
! 41: if (a == NULL) {
! 42: fprintf (stderr, "virtual memory exhausted\n");
! 43: abort ();
! 44: }
! 45: return a;
! 46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.