Skip to content

Commit d814002

Browse files
committed
Use functionality new in ppport.h 3.62
1 parent 17cebb7 commit d814002

File tree

2 files changed

+4
-134
lines changed

2 files changed

+4
-134
lines changed

vutil/vutil.h

-133
Original file line numberDiff line numberDiff line change
@@ -10,122 +10,12 @@
1010
* AV *av2 = MUTABLE_AV(sv); <== GOOD: it may warn
1111
*/
1212

13-
#ifndef MUTABLE_PTR
14-
# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
15-
# define MUTABLE_PTR(p) ({ void *_p = (p); _p; })
16-
# else
17-
# define MUTABLE_PTR(p) ((void *) (p))
18-
# endif
19-
#endif
20-
21-
#ifndef MUTABLE_AV
22-
# define MUTABLE_AV(p) ((AV *)MUTABLE_PTR(p))
23-
#endif
24-
#ifndef MUTABLE_CV
25-
# define MUTABLE_CV(p) ((CV *)MUTABLE_PTR(p))
26-
#endif
27-
#ifndef MUTABLE_GV
28-
# define MUTABLE_GV(p) ((GV *)MUTABLE_PTR(p))
29-
#endif
30-
#ifndef MUTABLE_HV
31-
# define MUTABLE_HV(p) ((HV *)MUTABLE_PTR(p))
32-
#endif
33-
#ifndef MUTABLE_IO
34-
# define MUTABLE_IO(p) ((IO *)MUTABLE_PTR(p))
35-
#endif
36-
#ifndef MUTABLE_SV
37-
# define MUTABLE_SV(p) ((SV *)MUTABLE_PTR(p))
38-
#endif
39-
40-
#ifndef SvPVx_nolen_const
41-
# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
42-
# define SvPVx_nolen_const(sv) ({SV *_sv = (sv); SvPV_nolen_const(_sv); })
43-
# else
44-
# define SvPVx_nolen_const(sv) (SvPV_nolen_const(sv))
45-
# endif
46-
#endif
47-
48-
#ifndef PERL_ARGS_ASSERT_CK_WARNER
49-
static void Perl_ck_warner(pTHX_ U32 err, const char* pat, ...);
50-
51-
# ifdef vwarner
52-
static
53-
void
54-
Perl_ck_warner(pTHX_ U32 err, const char* pat, ...)
55-
{
56-
va_list args;
57-
58-
PERL_UNUSED_ARG(err);
59-
if (ckWARN(err)) {
60-
va_list args;
61-
va_start(args, pat);
62-
vwarner(err, pat, &args);
63-
va_end(args);
64-
}
65-
}
66-
# else
67-
/* yes this replicates my_warner */
68-
static
69-
void
70-
Perl_ck_warner(pTHX_ U32 err, const char* pat, ...)
71-
{
72-
SV *sv;
73-
va_list args;
74-
75-
PERL_UNUSED_ARG(err);
76-
77-
va_start(args, pat);
78-
sv = vnewSVpvf(pat, &args);
79-
va_end(args);
80-
sv_2mortal(sv);
81-
warn("%s", SvPV_nolen(sv));
82-
}
83-
# endif
84-
#endif
85-
8613
#if PERL_VERSION_LT(5,15,4)
8714
# define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from(v,"version"))
8815
#else
8916
# define ISA_VERSION_OBJ(v) (sv_isobject(v) && sv_derived_from_pvn(v,"version",7,0))
9017
#endif
9118

92-
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
93-
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
94-
95-
/* prototype to pass -Wmissing-prototypes */
96-
STATIC void
97-
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
98-
99-
STATIC void
100-
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
101-
{
102-
const GV *const gv = CvGV(cv);
103-
104-
PERL_ARGS_ASSERT_CROAK_XS_USAGE;
105-
106-
if (gv) {
107-
const char *const gvname = GvNAME(gv);
108-
const HV *const stash = GvSTASH(gv);
109-
const char *const hvname = stash ? HvNAME(stash) : NULL;
110-
111-
if (hvname)
112-
Perl_croak_nocontext("Usage: %s::%s(%s)", hvname, gvname, params);
113-
else
114-
Perl_croak_nocontext("Usage: %s(%s)", gvname, params);
115-
} else {
116-
/* Pants. I don't think that it should be possible to get here. */
117-
Perl_croak_nocontext("Usage: CODE(0x%" UVxf ")(%s)", PTR2UV(cv), params);
118-
}
119-
}
120-
121-
#ifdef PERL_IMPLICIT_CONTEXT
122-
#define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b)
123-
#else
124-
#define croak_xs_usage S_croak_xs_usage
125-
#endif
126-
127-
#endif
128-
12919
#if PERL_VERSION_GE(5,9,0) && !defined(PERL_CORE)
13020

13121
# define VUTIL_REPLACE_CORE 1
@@ -222,29 +112,6 @@ const char * Perl_prescan_version(pTHX_ const char *s, bool strict, const char**
222112
#endif
223113

224114

225-
#if PERL_VERSION_LT(5,27,9)
226-
# define LC_NUMERIC_LOCK(cond)
227-
# define LC_NUMERIC_UNLOCK
228-
# if PERL_VERSION_LT(5,19,0)
229-
# undef STORE_LC_NUMERIC_SET_STANDARD
230-
# undef RESTORE_LC_NUMERIC
231-
# undef DECLARATION_FOR_LC_NUMERIC_MANIPULATION
232-
# ifdef USE_LOCALE
233-
# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION char *loc
234-
# define STORE_NUMERIC_SET_STANDARD()\
235-
loc = savepv(setlocale(LC_NUMERIC, NULL)); \
236-
SAVEFREEPV(loc); \
237-
setlocale(LC_NUMERIC, "C");
238-
# define RESTORE_LC_NUMERIC()\
239-
setlocale(LC_NUMERIC, loc);
240-
# else
241-
# define DECLARATION_FOR_LC_NUMERIC_MANIPULATION
242-
# define STORE_LC_NUMERIC_SET_STANDARD()
243-
# define RESTORE_LC_NUMERIC()
244-
# endif
245-
# endif
246-
#endif
247-
248115
#ifndef LOCK_NUMERIC_STANDARD
249116
# define LOCK_NUMERIC_STANDARD()
250117
#endif

vutil/vxs.xs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
#define NEED_vnewSVpvf
1010
#define NEED_newSVpvn_flags_GLOBAL
1111
#define NEED_warner
12+
#define NEED_ck_warner
13+
#define NEED_croak_xs_usage
14+
1215
/* end vutil.c */
1316
#include "ppport.h"
1417
#include "vutil.h"
@@ -54,6 +57,6 @@ BOOT:
5457
/* register the overloading (type 'A') magic */
5558
PL_amagic_generation++;
5659
do {
57-
newXS(xsub->name, xsub->xsub, file);
60+
newXS((char*)xsub->name, xsub->xsub, file);
5861
} while (++xsub < end);
5962
}

0 commit comments

Comments
 (0)