2 xmalloc - a safe malloc
4 Use this function instead of malloc whenever you don't intend to check
5 the return value yourself, for instance because you don't have a good
6 way to handle a zero return value.
8 Typically, Wine's own memory requests should be handles by this function,
9 while the client's should use malloc directly (and Wine should return an
10 error to the client if allocation fails).
12 Copyright 1995 by Morten Welinder.
25 res
= malloc (size
? size
: 1);
28 fprintf (stderr
, "Virtual memory exhausted.\n");
36 xrealloc (void *ptr
, size_t size
)
38 void *res
= realloc (ptr
, size
);
41 fprintf (stderr
, "Virtual memory exhausted.\n");
48 char *xstrdup( const char *str
)
50 char *res
= strdup( str
);
53 fprintf (stderr
, "Virtual memory exhausted.\n");