ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/IO-AIO/schmorp.h
(Generate patch)

Comparing IO-AIO/schmorp.h (file contents):
Revision 1.1 by root, Tue Jul 14 00:13:36 2009 UTC vs.
Revision 1.3 by root, Tue Jul 14 00:32:27 2009 UTC

1#ifndef SCHMORP_PERL_H_ 1#ifndef SCHMORP_PERL_H_
2#define SCHMORP_PERL_H_ 2#define SCHMORP_PERL_H_
3
4/* WARNING
5 * This header file is a shared resource between many modules.
6 */
3 7
4/* useful stuff, used by schmorp mostly */ 8/* useful stuff, used by schmorp mostly */
5 9
6#define PERL_VERSION_ATLEAST(a,b,c) \ 10#define PERL_VERSION_ATLEAST(a,b,c) \
7 (PERL_REVISION > (a) \ 11 (PERL_REVISION > (a) \
131static SV * 135static SV *
132s_get_cv (SV *cb_sv) 136s_get_cv (SV *cb_sv)
133{ 137{
134 HV *st; 138 HV *st;
135 GV *gvp; 139 GV *gvp;
136 CV *cv = sv_2cv (cb_sv, &st, &gvp, 0);
137 140
138 return (SV *)cv; 141 SvGETMAGIC (cb_sv);
142 return SvOK (cb_sv) ? sv_2cv (cb_sv, &st, &gvp, 0) : 0;
139} 143}
140 144
141static SV * 145static SV *
142s_get_cv_croak (SV *cb_sv) 146s_get_cv_croak (SV *cb_sv)
143{ 147{
144 cb_sv = s_get_cv (cb_sv); 148 SV *cv = s_get_cv (cb_sv);
145 149
146 if (!cb_sv) 150 if (!cv)
147 croak ("%s: callback must be a CODE reference or another callable object", SvPV_nolen (cb_sv)); 151 croak ("%s: callback must be a CODE reference or another callable object", SvPV_nolen (cb_sv));
148 152
149 return cb_sv; 153 return cv;
150} 154}
151 155
152/*****************************************************************************/ 156/*****************************************************************************/
153/* gensub: simple closure generation utility */ 157/* gensub: simple closure generation utility */
154 158

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines