--- rxvt-unicode/src/iom_perl.h 2006/12/14 15:19:31 1.1 +++ rxvt-unicode/src/iom_perl.h 2006/12/16 02:06:57 1.4 @@ -1,3 +1,11 @@ +typedef int IOM_CHAINED; + +static SV * +iom_new_ref (HV *hv, const char *klass) +{ + return sv_bless (newRV ((SV *)hv), gv_stashpv (klass, 1)); +} + ///////////////////////////////////////////////////////////////////////////// #define SvWATCHER(sv) (perl_watcher *)SvPTR (sv, IOM_CLASS "::watcher") @@ -50,10 +58,10 @@ LEAVE; if (SvTRUE (ERRSV)) - rxvt_warn ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); + IOM_WARN ("%s callback evaluation error: %s", type, SvPV_nolen (ERRSV)); } -#define newSVtimer(timer) new_ref ((timer)->self, IOM_CLASS "::timer") +#define newSVtimer(timer) iom_new_ref ((timer)->self, IOM_CLASS "::timer") #define SvTIMER(sv) (timer *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::timer") struct timer : perl_watcher, time_watcher @@ -74,7 +82,7 @@ } }; -#define newSViow(iow) new_ref ((iow)->self, IOM_CLASS "::iow") +#define newSViow(iow) iom_new_ref ((iow)->self, IOM_CLASS "::iow") #define SvIOW(sv) (iow *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iow") struct iow : perl_watcher, io_watcher @@ -90,7 +98,7 @@ } }; -#define newSViw(iw) new_ref ((iw)->self, IOM_CLASS "::iw") +#define newSViw(iw) iom_new_ref ((iw)->self, IOM_CLASS "::iw") #define SvIW(sv) (iw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::iw") struct iw : perl_watcher, idle_watcher @@ -106,7 +114,7 @@ } }; -#define newSVpw(pw) new_ref ((pw)->self, IOM_CLASS "::pw") +#define newSVpw(pw) iom_new_ref ((pw)->self, IOM_CLASS "::pw") #define SvPW(sv) (pw *)(perl_watcher *)SvPTR ((sv), IOM_CLASS "::pw") struct pw : perl_watcher, child_watcher