Thank you,  I understood that you meant to check the pointer returned by
hv_fetch before dereferencing it.

Thanks all for your suggestions!  They certainly improve on my code.

However, the actual cause of the core dumps has been found to be outside my
perl/xs code after all...

Tamar

> >I think the above line should have been
> >
> >    if (svp) {
> >
> >The point of the check is to ensure that you don't de-ref svp (i.e.
> >don't use *svp) if svp is NULL.
> >
> >This could explain your continued core dumps.
>
> Whoops - you are of course correct Steve - thanks for spotting that.
>
>
> >
> >Steve
> >
> >>     if (SvOK(*svp)) {
> >>       /* defined value of some kind (but may not be a string, but SvPV
will
> >>          force that for us). In perl5.6+ you may need to consider case
> >>          of string being in UTF-8
> >>        */
> >>       return SvPV_nolen(*svp);
> >>     }
> >>     else
> >>      {
> >>       /* undef value */
> >>       return "";
> >>      }
> >>  }
> >>  else {
> >>    /* No such member */
> >>    return NULL;
> >>  }
> >>
> >>
> --
> Nick Ing-Simmons
> http://www.ni-s.u-net.com/
>


Reply via email to