Skip to content

Instantly share code, notes, and snippets.

@avar
Created February 5, 2013 19:46
Show Gist options
  • Save avar/4717056 to your computer and use it in GitHub Desktop.
Save avar/4717056 to your computer and use it in GitHub Desktop.
Generated content from Taint::Util
/*
* This file was generated automatically by ExtUtils::ParseXS version 2.21 from the
* contents of Util.xs. Do not edit this file, edit Util.xs instead.
*
* ANY CHANGES MADE HERE WILL BE LOST!
*
*/
#line 1 "Util.xs"
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#line 15 "Util.c"
#ifndef PERL_UNUSED_VAR
# define PERL_UNUSED_VAR(var) if (0) var = var
#endif
#ifndef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#define PERL_ARGS_ASSERT_CROAK_XS_USAGE assert(cv); assert(params)
/* prototype to pass -Wmissing-prototypes */
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params);
STATIC void
S_croak_xs_usage(pTHX_ const CV *const cv, const char *const params)
{
const GV *const gv = CvGV(cv);
PERL_ARGS_ASSERT_CROAK_XS_USAGE;
if (gv) {
const char *const gvname = GvNAME(gv);
const HV *const stash = GvSTASH(gv);
const char *const hvname = stash ? HvNAME(stash) : NULL;
if (hvname)
Perl_croak(aTHX_ "Usage: %s::%s(%s)", hvname, gvname, params);
else
Perl_croak(aTHX_ "Usage: %s(%s)", gvname, params);
} else {
/* Pants. I don't think that it should be possible to get here. */
Perl_croak(aTHX_ "Usage: CODE(0x%"UVxf")(%s)", PTR2UV(cv), params);
}
}
#undef PERL_ARGS_ASSERT_CROAK_XS_USAGE
#ifdef PERL_IMPLICIT_CONTEXT
#define croak_xs_usage(a,b) S_croak_xs_usage(aTHX_ a,b)
#else
#define croak_xs_usage S_croak_xs_usage
#endif
#endif
/* NOTE: the prototype of newXSproto() is different in versions of perls,
* so we define a portable version of newXSproto()
*/
#ifdef newXS_flags
#define newXSproto_portable(name, c_impl, file, proto) newXS_flags(name, c_impl, file, proto, 0)
#else
#define newXSproto_portable(name, c_impl, file, proto) (PL_Sv=(SV*)newXS(name, c_impl, file), sv_setpv(PL_Sv, proto), (CV*)PL_Sv)
#endif /* !defined(newXS_flags) */
#line 67 "Util.c"
XS(XS_Taint__Util_tainted); /* prototype to pass -Wmissing-prototypes */
XS(XS_Taint__Util_tainted)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
if (items != 1)
croak_xs_usage(cv, "sv");
PERL_UNUSED_VAR(ax); /* -Wall */
SP -= items;
{
SV * sv = ST(0);
#line 10 "Util.xs"
EXTEND(SP, 1);
if (SvTAINTED(sv))
PUSHs(&PL_sv_yes);
else
PUSHs(&PL_sv_no);
#line 89 "Util.c"
PUTBACK;
return;
}
}
XS(XS_Taint__Util_taint); /* prototype to pass -Wmissing-prototypes */
XS(XS_Taint__Util_taint)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(ax); /* -Wall */
SP -= items;
{
#line 19 "Util.xs"
I32 i;
#line 110 "Util.c"
#line 21 "Util.xs"
for (i = 0; i < items; ++i)
if (!SvREADONLY(ST(i)))
SvTAINTED_on(ST(i));
#line 115 "Util.c"
PUTBACK;
return;
}
}
XS(XS_Taint__Util_untaint); /* prototype to pass -Wmissing-prototypes */
XS(XS_Taint__Util_untaint)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(ax); /* -Wall */
SP -= items;
{
#line 28 "Util.xs"
I32 i;
#line 136 "Util.c"
#line 30 "Util.xs"
for (i = 0; i < items; ++i)
SvTAINTED_off(ST(i));
#line 140 "Util.c"
PUTBACK;
return;
}
}
#ifdef __cplusplus
extern "C"
#endif
XS(boot_Taint__Util); /* prototype to pass -Wmissing-prototypes */
XS(boot_Taint__Util)
{
#ifdef dVAR
dVAR; dXSARGS;
#else
dXSARGS;
#endif
#if (PERL_REVISION == 5 && PERL_VERSION < 9)
char* file = __FILE__;
#else
const char* file = __FILE__;
#endif
PERL_UNUSED_VAR(cv); /* -W */
PERL_UNUSED_VAR(items); /* -W */
XS_VERSION_BOOTCHECK ;
(void)newXS("Taint::Util::tainted", XS_Taint__Util_tainted, file);
(void)newXS("Taint::Util::taint", XS_Taint__Util_taint, file);
(void)newXS("Taint::Util::untaint", XS_Taint__Util_untaint, file);
#if (PERL_REVISION == 5 && PERL_VERSION >= 9)
if (PL_unitcheckav)
call_list(PL_scopestack_ix, PL_unitcheckav);
#endif
XSRETURN_YES;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment