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) () {
14    dTHX;
15    SV *source = newSVpvn_share("pie", 3, 0);
16    SV *destination = newSV(0);
17    bool result;
18
19    if(!SvIsCOW(source)) {
20	SvREFCNT_dec(source);
21	Perl_croak(aTHX_ "Creating a shared hash key scalar failed when "
22	       STRINGIFY(SUFFIX) " got flags %" UVxf, (UV)SvFLAGS(source));
23    }
24
25    sv_setsv(destination, source);
26
27    result = cBOOL(SvIsCOW(destination));
28
29    SvREFCNT_dec(source);
30    SvREFCNT_dec(destination);
31
32    return result;
33}
34
35/*
36 * Local variables:
37 * mode: c
38 * End:
39 *
40 * ex: set ts=8 sts=4 sw=4 et:
41 */
42