(SWIG_Guile_NewPointerObj): Return '() to represent null pointers.

This is for compatibility with the -gh version.
Also, GOOPS objects representing null pointers would behave very
badly, like segfaulting when one DESCRIBEs them.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5383 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Matthias Köppe 2003-11-24 16:55:22 +00:00
commit ba4943e63d

View file

@ -102,26 +102,29 @@ static SCM swig_symbol = SCM_EOL;
SWIGRUNTIME(SCM) SWIGRUNTIME(SCM)
SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner) SWIG_Guile_NewPointerObj(void *ptr, swig_type_info *type, int owner)
{ {
SCM smob; if (ptr == NULL)
swig_guile_clientdata *cdata = (swig_guile_clientdata *) type->clientdata; return SCM_EOL;
if (owner) else {
SCM_NEWSMOB2(smob, swig_collectable_tag, ptr, (void *) type); SCM smob;
else swig_guile_clientdata *cdata = (swig_guile_clientdata *) type->clientdata;
SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type); if (owner)
SCM_NEWSMOB2(smob, swig_collectable_tag, ptr, (void *) type);
else
SCM_NEWSMOB2(smob, swig_tag, ptr, (void *) type);
if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) { if (!cdata || SCM_NULLP(cdata->goops_class) || swig_make_func == SCM_EOL ) {
return smob; return smob;
} else { } else {
/* the scm_make() C function only handles the creation of gf, methods and classes (no instances) /* the scm_make() C function only handles the creation of gf,
the (make ...) function is later redefined in goops.scm. So we need to lookup and methods and classes (no instances) the (make ...) function is
call that function */ later redefined in goops.scm. So we need to call that
return scm_apply( Scheme function. */
swig_make_func, return scm_apply(swig_make_func,
scm_list_3( scm_list_3(cdata->goops_class,
cdata->goops_class, swig_keyword,
swig_keyword, smob),
smob), SCM_EOL);
SCM_EOL); }
} }
} }