On Thu, 1 Oct 2015 19:51:12 +0200
David Emanuel da Costa Santiago <deman...@gmail.com> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> 
> Now with the code attached.
> 
> Best regards,
> David Santiago
> 

Hi David!

One thing that strikes me as a problem is the fact that _yenc_encode_c returns
a string that was malloc()ed/realloc()ed and I don't think that Inline::C will
free() it for you. What you should try to do is:

char* _yenc_encode_c(unsigned char* data, size_t data_size)
{
        .
        .
        .
}

SV* yenc_encode_c_for_perl(unsigned char* data, size_t data_size)
{
    SV * ret;
    char * s;
    s = _yenc_encode_c(data, data_size);

    ret = newSVpv(s, 0);
    free(s);
    return ret;
}
»

And then use yenc_encode_c_for_perl() in your Perl program.

Regards,

        Shlomi Fish

P.S: does the «SV * ret» need to be made mortal?

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
List of Networking Clients - http://shlom.in/net-clients

Chuck Norris made the baby Jesus stop crying.
    — http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/

Please reply to list if it's a mailing list post - http://shlom.in/reply .

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to