This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Forgot to add the new files for 29248.
[perl5.git] / ext / XS / APItest / core_or_not.inc
CommitLineData
3e8ab2ef
NC
1/* This code is compiled twice, once with -DPERL_CORE defined, once without */
2
3#include "EXTERN.h"
4#include "perl.h"
5
6#ifdef PERL_CORE
7# define SUFFIX core
8#else
9# define SUFFIX notcore
10#endif
11
12bool
13CAT2(sv_setsv_cow_hashkey_, SUFFIX) (pTHX) {
14 SV *source = newSVpvn_share("pie", 3, 0);
15 SV *destination = newSV(0);
16 bool result;
17
18 if(!SvREADONLY(source) && !SvFAKE(source)) {
19 SvREFCNT_dec(source);
20 croak ("Creating a shared hash key scalar failed when "
21 STRINGIFY(SUFFIX) " got flags %"UVxf, (UV)SvFLAGS(source));
22 }
23
24 sv_setsv(destination, source);
25
26 result = SvREADONLY(destination) && SvFAKE(destination);
27
28 SvREFCNT_dec(source);
29 SvREFCNT_dec(destination);
30
31 return result;
32}
33
34/*
35 * Local variables:
36 * mode: c
37 * c-indentation-style: bsd
38 * c-basic-offset: 4
39 * indent-tabs-mode: t
40 * End:
41 *
42 * ex: set ts=8 sts=4 sw=4 noet:
43 */