ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Guard/Guard.xs
(Generate patch)

Comparing Guard/Guard.xs (file contents):
Revision 1.10 by root, Sun Jul 19 04:43:47 2009 UTC vs.
Revision 1.12 by root, Thu Nov 20 18:13:58 2014 UTC

2 2
3#include "EXTERN.h" 3#include "EXTERN.h"
4#include "perl.h" 4#include "perl.h"
5#include "XSUB.h" 5#include "XSUB.h"
6 6
7#include "patchlevel.h"
8
9#define PERL_VERSION_ATLEAST(a,b,c) \
10 (PERL_REVISION > (a) \
11 || (PERL_REVISION == (a) \
12 && (PERL_VERSION > (b) \
13 || (PERL_VERSION == (b) && PERL_SUBVERSION >= (c)))))
14
15/* apparently < 5.8.8 */
7#ifndef SvSTASH_set 16#ifndef SvSTASH_set
8# define SvSTASH_set(x,a) SvSTASH(x) = (a) 17# define SvSTASH_set(x,a) SvSTASH(x) = (a)
9#endif 18#endif
10 19
11#ifndef PERL_MAGIC_ext 20#ifndef PERL_MAGIC_ext
101SV * 110SV *
102guard (SV *block) 111guard (SV *block)
103 PROTOTYPE: & 112 PROTOTYPE: &
104 CODE: 113 CODE:
105{ 114{
106 SV *cv = guard_get_cv (aTHX_ block); 115 SV *cv = guard_get_cv (aTHX_ block);
107 SV *guard = NEWSV (0, 0); 116 SV *guard = NEWSV (0, 0);
108 SvUPGRADE (guard, SVt_PVMG); 117 SvUPGRADE (guard, SVt_PVMG);
109 sv_magicext (guard, cv, PERL_MAGIC_ext, &guard_vtbl, 0, 0); 118 sv_magicext (guard, cv, PERL_MAGIC_ext, &guard_vtbl, 0, 0);
110 RETVAL = newRV_noinc (guard); 119 RETVAL = newRV_noinc (guard);
111 SvOBJECT_on (guard); 120 SvOBJECT_on (guard);
121#if !PERL_VERSION_ATLEAST(5,18,0)
112 ++PL_sv_objcount; 122 ++PL_sv_objcount;
123#endif
113 SvSTASH_set (guard, (HV*)SvREFCNT_inc ((SV *)guard_stash)); 124 SvSTASH_set (guard, (HV*)SvREFCNT_inc ((SV *)guard_stash));
114} 125}
115 OUTPUT: 126 OUTPUT:
116 RETVAL 127 RETVAL
117 128

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines