Dimitrie Paun wrote:
> It seems to me there are way too many interfaces to alocate memory. The ones
> described in xmalloc.h add little functionality, but provide confusion and
> promote lazyness most of the time.
>
> This patch tries to get rid of the xmalloc functions. It eliminates xcalloc,
> xrealloc, and xstrdup.
>
> Next patch will eliminate xmalloc. Meanwhile, try not to use it :)
[snip]
> - bmpImage->data = xcalloc( bmpImage->bytes_per_line * lines );
> + bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
> + if(bmpImage->data == NULL) {
> + WARN("Out of memory!");
> + XDestroyImage( bmpImage );
> + return lines;
> + }
[etc...]
You should not use malloc and friends at all because they are not
thread-safe. These functions should map to windows-equivalents. However,
these functions are, in principle, available in wine, but cannot be
accessed due to name conflicts with libc. Using the windows/process heap
would solve these issues.
Greetings Bertho