Re: [hatari-devel] Re: Hatari SCSI Driver patch

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 14/09/2015 21:31, Uwe Seimet a écrit :
Hi,

Looks as if I have to take special care of cases where NULL pointers are
passed via NatFeats. How do I correctly check for NULL addresses in
Hatari?


Hi

take a look at natfeats.c for example :

static bool nf_name(Uint32 stack, Uint32 subid, Uint32 *retval)
{
        Uint32 ptr, len;
        const char *str;
        char *buf;

        ptr = STMemory_ReadLong(stack);
        len = STMemory_ReadLong(stack + SIZE_LONG);


so, you can access the value in 'stack' and do for example :

if ( ptr == 0x0 )
 /* value is null */
else
 /* value is not null */


Nicolas




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/