Porting to RISC OS

Matthias Andree matthias.andree at gmx.de
Thu Sep 4 14:21:55 CEST 2003


Stefan Bellon <sbellon at sbellon.de> writes:

> I've ported bogofilter to the rarely known operating system RISC OS.

A former fellow student of mine showed me his Risc PC (don't recall the
exact type or CPU and memory) in I believe 1997, with these stackable
case and Risc OS 3.X IIRC, but I chose to buy a 68060 board for my Amiga
4000 instead. ;-)

> Depending on which RISC OS compiler I use, I run into trouble with the
> xmalloc/xcalloc functions.
>
> At present, it may be possible that malloc(0) is called and afterwards
> it's checked what happened.

Correct. malloc returns NULL on failure (usually ENOMEM, out of
memory). Some implementations however also return NULL for malloc(0),
which is allowed by IEEE Std 1003.1-2001, so if we're getting NULL, we
need to differentiate between "malloc implementation behaviour" and "out
of memory". If malloc has returned non-NULL, there's no need to check
any special case. We don't want to do that.

> I think it may be safer to rewrite the code to read as follows:

Why is it safer? I don't see where it is, and it slows xmalloc() down.

> In fact, I had to rewrite it this way in order to work-around what
> seems to be a bug in our UnixLib

Can you give details? I fail to see how even the most severe malloc()
bug would require a rewrite/change of xmalloc.

-- 
Matthias Andree

Encrypt your mail: my GnuPG key ID is 0x052E7D95




More information about the bogofilter-dev mailing list