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 handled by this function,
9 while the clients should use malloc directly (and Wine should return an
10 error to the client if allocation fails).
12 Copyright 1995 by Morten Welinder.
21 void *xmalloc( int size
)
25 res
= malloc (size
? size
: 1);
28 MSG("Virtual memory exhausted.\n");
35 void *xcalloc( int size
)
45 void *xrealloc( void *ptr
, int size
)
47 void *res
= realloc (ptr
, size
);
48 if ((res
== NULL
) && size
)
50 MSG("Virtual memory exhausted.\n");
57 char *xstrdup( const char *str
)
59 char *res
= strdup( str
);
62 MSG("Virtual memory exhausted.\n");