develooper Front page | perl.perl5.porters | Postings from February 2021

Re: Looking for someone to adopt adding trim() to core

Thread Previous | Thread Next
From:
Tony Cook
Date:
February 15, 2021 21:31
Subject:
Re: Looking for someone to adopt adding trim() to core
Message ID:
20210215213059.GF12122@venus.tony.develop-help.com
On Mon, Feb 15, 2021 at 01:30:07PM +0100, demerphq wrote:
> +XS(XS_scalar_trim); /* prototype to pass -Wmissing-prototypes */
> +XS(XS_scalar_trim)
> +{
> +    dXSARGS;
> +    SV * input;
> +    SV * ret = NULL;
> +
> +    if (items != 1)
> +        croak_xs_usage(cv, "trim");
> +
> +    SP -= items;
> +    PUTBACK;
> +
> +    input = ST(0);
> +    if (SvOK(input)) {

If input is magical then this will check the pre-mg_get() version of
the flag.  (ie. you need SvGETMAGIC(input) before this).

Tony

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About