--with-gc enables now support for Boehm's GC, if it's found and glib2 is

used. This also enables an extra check for perl library to verify scripts
aren't using objects that have already been free'd - while not a fully safe
solution it's much better than before :)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3063 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-12-23 06:06:14 +00:00 committed by cras
commit cdc52b773e
3 changed files with 117 additions and 4 deletions

View file

@ -43,6 +43,10 @@
#include "perl-core.h"
#include "perl-common.h"
#ifdef HAVE_GC
# include <gc/gc.h>
#endif
typedef struct {
char *stash;
PERL_OBJECT_FUNC fill_func;
@ -151,6 +155,7 @@ void *irssi_ref_object(SV *o)
{
SV **sv;
HV *hv;
void *p;
hv = hvref(o);
if (hv == NULL)
@ -158,8 +163,13 @@ void *irssi_ref_object(SV *o)
sv = hv_fetch(hv, "_irssi", 6, 0);
if (sv == NULL)
croak("variable is damaged");
return GINT_TO_POINTER(SvIV(*sv));
croak("variable is damaged");
p = GINT_TO_POINTER(SvIV(*sv));
#ifdef HAVE_GC
if (GC_base(p) == NULL)
croak("variable is already free'd");
#endif
return p;
}
void irssi_add_object(int type, int chat_type, const char *stash,